From patchwork Mon Sep 5 23:17:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 12966620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F25E2ECAAD3 for ; Mon, 5 Sep 2022 23:18:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B63BA1652; Tue, 6 Sep 2022 01:17:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B63BA1652 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1662419927; bh=VsZvo0BksPOfxAqns3yc9+HfnA+je/l6S4PAYMaTU3M=; h=From:Subject:To:In-Reply-To:References:Date:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RrirFa+gJ1uwuyHDIq1nxUjaGi4ewnTbY1XpzTxBrTsVjf4lV8vgukzn79tHIgj9A PQDUmAAA2ES27oqrM6Zhqiw8hZfTuZfGL4Jkyx/UELYYfibe1g9RNWsiQYFmmrXHlv khtcMckF/urifXYeTKz0etjkIS0xQJiOnvNOMPOY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E7C99F80165; Tue, 6 Sep 2022 01:17:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EBF25F80482; Tue, 6 Sep 2022 01:17:42 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2122.outbound.protection.outlook.com [40.107.113.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E8E3CF80165 for ; Tue, 6 Sep 2022 01:17:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E8E3CF80165 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="TWQvxebt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YP1+mV+jm0YrtfKmAgMuSb9aixgw5/im80MaFxqi9BDbNwE9kJVdUeB+A1bEE2vvdhIsWVtkXjx/fCxX7X6ybCkbO9bWbkQDn3qT4UkRdVKLNjOjKYEszp1EhT4HKF6K4dsu9jyKMrP+Cn9H6p/U6luXC88ctUSBfHILITLXOEbLaBMK/RYgelnpJFgqAXK7/yLy4mEHJCE+qMA61jHFiayNZb1uI9IAS1QFLeL9ZRJEl5jNYWerpE00TZAjG/jL3DArV8BxJLNSEDGxy+8gknv0mX7TcFuixf6lLYcAd6S5Z9UyQUvrFGWDW8FrqEUPyuEGPqynq/dc2cOPrSGCrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XEuf/YnJ9LBOTgUK8/rw7STyT1ESvFrPHl8SHT68/UI=; b=Up+xLUlAQpt/cPcpm82ryzCxa5X4PTkYzrh27TKMwgt7Vj8e3ti1IB2W0Ta9I+hmzxB/7FstKek24SW508ewKn2WBs5F1mMqhLJ6ZsCuIUoGfIWfpYGOZjsf/Rk33CFNJbN0GlNA3Bzaw6ou997l6+hYWCwSFqYaT+tJb3vu3MJ2XETJqcQqesT77mcMLqy1ApO0myq/mToXCPQK4AaqhRbma9qUWHKEETTbORkGKfBvOSBazY4KBG3ckgp+BLYkgMAOJ7vccbme5KRIAua/jM8QVxfkKWNM0C2gaEecUNGgj1k1SsUcqB04x4kyT6M2lCl5JfU6r0IGf+YcGwM5NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XEuf/YnJ9LBOTgUK8/rw7STyT1ESvFrPHl8SHT68/UI=; b=TWQvxebtdhnkiwE9/U7ffWRgxCFK968YdKGnrShHLP2ne+dNrY+LVK0xeuL3lnCUnT15+ta4NUyVzy04EYruYye/UI5/BQZSS4jZhUWkKTSzGzSyNxppkbG4ZYj8G+A7dKFUwxpbKnFKCEGMEwnQDKrLhVq7l6PcvVk67g/lyIc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYCPR01MB8191.jpnprd01.prod.outlook.com (2603:1096:400:104::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12; Mon, 5 Sep 2022 23:17:30 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6%3]) with mapi id 15.20.5588.018; Mon, 5 Sep 2022 23:17:30 +0000 Message-ID: <871qsp9zsm.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/4] ASoC: soc-dapm.c: don't use kzalloc() for param on snd_soc_dai_link_event_pre_pmu() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> References: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Sep 2022 23:17:29 +0000 X-ClientProxiedBy: TYBP286CA0017.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:ce::29) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8a765e18-5592-4ecf-858b-08da8f94cdd0 X-MS-TrafficTypeDiagnostic: TYCPR01MB8191:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TrfcaVGVq+zP0nVqHq5FdDRId0PyQehvnnSM9IBMtkbaZ8hECvj8/TgLHf62Q6AnVdAKnKYR8bf4xUwTTP0QLAHrCUc582Dv2Izi2O0zXGvQj2wuuK8p6NhyIgKgDeNt9ZYuh1uUdAwzN3VFHOMKLZZEkDTwNSqTSuBLeBzjggO0zdobBFh9LEy45aJjFZHjkZmaJouRkx5gkvvkSD+ICnFG20CX/X7rmadjrp67gAyYTVc6sZ6f3S6ZvMd4tSzp9ACqOgyflV2xf2rdu3PLvQlB/UNUaNaAeBRPcb5ikDZzMNTiRpZtWV8pCzwDTttGqXOlN6VCDVTBKYVzW+Zg5BvD1oOqHIgaE5G+NkBp30YlARZBdaC0rhaP5AhjZbzgtib/yQkv5HoVTi11jCQ0s+jjFUn9UG/xM75V1JfkTyR2R9ewEbg4131uzY1f0g3LJJWLsFiH+iIDr08byACmIGl4ussCi54hIK1MKGDuBU7MUChEIkYfBEb1sV7w2R1nj7aSZIY60B1Xre/v5anXmqASdVPoAQ5axsFYg6GPvlh0PF13GyxIJ1DdZtDEvUPOnyiLpnprJWwl3x16PjlNb1ZXoEGXz1bGPSytpgZUb2hGQxtGTtyTYLucFf6/ls01ICO5Yl3vvVLduZ81+Rd6AzqUI8+h45jNKKpKXkeq4nWGlZp7tHjaAqovVhBAnS7xAzanGSiDCkY4751AzcPeJTRnAeU5V/jXgqXXWpLD1BE4EhuHTIRE5ErKQP3k4MItPAMvgvWAuxn9v2xEiTyKMg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(396003)(136003)(39860400002)(366004)(8936002)(83380400001)(8676002)(66476007)(66556008)(66946007)(4326008)(6506007)(52116002)(26005)(6512007)(41300700001)(2616005)(186003)(86362001)(38100700002)(6916009)(316002)(2906002)(478600001)(6486002)(38350700002)(36756003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ID2+Ealw+ccnzuNT6hfykfXOGSFnBCavAIVd31PcnSEwri7HcnzjU5kzKpHoYQPZJ9QDb5mdfB0yhGzzv7zCKq1/SgAALwfH01yT0LsQoVNhCO08+q9e8P0WNmnE7guwy3M49I+goXYEB8yollVSimNaeP4nY2D3jLOa+kQYxpX39z21WSaFPn8gfTmUHkSK5C7eiF1GVWVaLUQ6EVkqWEBido/7cyMhFQEI3SwIZ2ALLh1Bo/oxgViQw/vOfees1S+wOoVJBs97tm5xhuxH4Zmfx5fkm3Cl1/m0ELS3jx1u3DGB85mNXF/MEMmWpU/TmlSDCx3A5HFz2vZe6u8u+gRCZG0Nsupk2ZbJ7T5pk8EYx7ksSu7zCpMCrWCnk2ucqjkq+BmCtKmfZFmKQegvYtJu8AHKGj/IS50CWpAuKz6da6RVVCu30DeQQkIzTVr1/DM1htVa1nYn45QQtb9UAWL24aZJ3KJU6JMV4dKq5pL4nwxLiEsB5Dw1ThZXVNrO8FXe2NW+T35E/THBPeYkn/gw98wxL4s0YqoSk5vsHrgP6LkjSr6/ZAWAFs79hwc9+7HYzlSAdPfMroqbPnpYZQjVcbrdytMWes9mTHZLJyofCbuP+hJPaWkkApHrJ/vCbSi5ahGyKRIY4WmYbf5YwnZZekRiBBeIy3WyAXsUu+STSzV9d3ptX0DZrOFaw1q9uYZnu2GFrd1OqBfQGPP3jctF5lIVbZVsAbVtk5tDRHFQseir8CEUYS6PgoIsNwJ00w0yxZnRAv42aWIW0Ki91Te/Dav6yMt+3mYzd+qMZcpqQCEv5N4FRZeG7jcCG+XtsQZWcGSi+uge0es7zmQcr1s7CIMIzjGLYsw5v+xJo/DIwUVVPxqaH3S2g7dexA3OLTceBd3jzk2gjcwTQAXogi9eFPKoXlj1j3SjTVGSt1yZMgBrXt/CLLMaqOR5o/5SemSZ2yFsmilofq9RtXxgWoWBJBZOl//yEQUs2yOlSv4RpVUj1S6la0VxMGBnfs0HjLoXor+W1BLLAssx/D7KgI9zbfToDo7oaHQNn5ZwcJKMF0wCDzR8MNVfOvJ4PUXrZW3Mi1rk1swTBvAxPv8zuXSefYxq1KhMQ7mlHh+jQpe+rOpzDltoePnadaP15MjK2+Jw+r5DwxMpSlE2hJG5NImv/EsSYEbY9/LZEJmNPC3SFiT6H/86xUt6n1weGj6bKmUcf6yMz+KLDxsk9XvqmJ2DVio/zkXpCI0LB5AUZmavg/3qeMWbaUyeZuK2m5k6Tn9TdgsnJeSX14sffdO65UxH7s0JCM56RHBxionoTEGSLQRTXSTN6jRpmU00+63OvGGX3J+LAJxBhG+LrCHu4i+Op5Ld+S6UbEQ85QEi2okK8k6/7uvsq78jQTBBrtKuSjBhX9W6mU265//JCOchGiawyyF23tf7xcZ6qm6IUpnwaUi5kdGECL4ETzDWYo52vILGZc4x+Mcak7sX7IHQeSX+XKKn/qhYpo/NW2ZG8hiyukRmCv/8a9RN5UQG5ncPtAuk/FlJxVW9dZFtE6f2BzRu9lObC9ftxv5xSKXqm2EyvZMwRvKeKOHov+AZmOMr0ZZs4wJNzLYSFfCGMRP6JHI5U2sjxLXDDKmpAW3tbGU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a765e18-5592-4ecf-858b-08da8f94cdd0 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 23:17:29.9460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8Ik0O52P/8voMpgzxxrzykBb51foILOwM58fHoS7OQm3v6KDAedsgWZpgZiPRVQFvxMYKApTwKdqL8WOnIXZMFyacWZP/+WaarcrpqIbyuSxOufewq1reoVLS5KF92RG X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB8191 Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Kuninori Morimoto Current snd_soc_dai_link_event_pre_pmu() is using kzalloc() / kfree() for "params", but it is fixed size, and not used on private data. It is used for setup rtd at end of this function, just a local variable. We don't need to use kzalloc() / kfree() for it. This patch replace it as local variable. Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 73b8bd452ca7..7d4e4068f870 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3837,15 +3837,13 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, struct snd_soc_dapm_path *path; struct snd_soc_dai *source, *sink; struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); - struct snd_pcm_hw_params *params = NULL; + struct snd_pcm_hw_params params; const struct snd_soc_pcm_stream *config = NULL; struct snd_pcm_runtime *runtime = NULL; unsigned int fmt; int ret = 0; - params = kzalloc(sizeof(*params), GFP_KERNEL); - if (!params) - return -ENOMEM; + memset(¶ms, 0, sizeof(params)); runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); if (!runtime) { @@ -3902,45 +3900,39 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, goto out; } - snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), fmt); - hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = - config->rate_min; - hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max = - config->rate_max; - hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->min - = config->channels_min; - hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max - = config->channels_max; + snd_mask_set(hw_param_mask(¶ms, SNDRV_PCM_HW_PARAM_FORMAT), fmt); + hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->min = config->rate_min; + hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->max = config->rate_max; + hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS)->min = config->channels_min; + hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_CHANNELS)->max = config->channels_max; substream->stream = SNDRV_PCM_STREAM_CAPTURE; snd_soc_dapm_widget_for_each_source_path(w, path) { source = path->source->priv; - ret = snd_soc_dai_hw_params(source, substream, params); + ret = snd_soc_dai_hw_params(source, substream, ¶ms); if (ret < 0) goto out; - dapm_update_dai_unlocked(substream, params, source); + dapm_update_dai_unlocked(substream, ¶ms, source); } substream->stream = SNDRV_PCM_STREAM_PLAYBACK; snd_soc_dapm_widget_for_each_sink_path(w, path) { sink = path->sink->priv; - ret = snd_soc_dai_hw_params(sink, substream, params); + ret = snd_soc_dai_hw_params(sink, substream, ¶ms); if (ret < 0) goto out; - dapm_update_dai_unlocked(substream, params, sink); + dapm_update_dai_unlocked(substream, ¶ms, sink); } - runtime->format = params_format(params); - runtime->subformat = params_subformat(params); - runtime->channels = params_channels(params); - runtime->rate = params_rate(params); - + runtime->format = params_format(¶ms); + runtime->subformat = params_subformat(¶ms); + runtime->channels = params_channels(¶ms); + runtime->rate = params_rate(¶ms); out: - kfree(params); return ret; } From patchwork Mon Sep 5 23:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 12966621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BA9DECAAD3 for ; Mon, 5 Sep 2022 23:19:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 62C771663; Tue, 6 Sep 2022 01:18:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 62C771663 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1662419952; bh=KWSl+/hP6Tj4LOXrppGp2b3nXy7jv3Kqva2A0nsPoPo=; h=From:Subject:To:In-Reply-To:References:Date:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=m0S2xHiL+lNpMt7Q4aCrjZAhxhNifjLh17AdhDJpx+LBH0fG1yQP60ijQT8xkomDm SZ7XiLoxMQAXaZeYwbJ+TotJueKsTQGvXNXyOlMJe639b+eBy3IsrdEwy2XUYvWJ8t B3S1gdlufvvKtEz3B09+gmKD6dIn/9eWIqkrtTec= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DE1FFF80538; Tue, 6 Sep 2022 01:17:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DB0C5F8053A; Tue, 6 Sep 2022 01:17:56 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2134.outbound.protection.outlook.com [40.107.113.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 87B29F80527 for ; Tue, 6 Sep 2022 01:17:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 87B29F80527 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="KFkXRlLF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fn+cLhgyo1LZYgWQAdKM6s9LA3ALCYtdawCI+CZWSUc0ZA0Li6HFPPwnkjJ2ckKd7PmqtLwZ72ZsOccK9eda/bIOMn6QEbZND5wx6sVhU51hel0vAfZzLD4ZXyOD2ZbOquOtRvyq2tZmU2zQorImeveARbNt42ZTitqcAv8P9tIVz1X2cYMFbRJ/yuXBrFlo+nx3sDujadrUbRcOL42Rc4VuwBP4mAplyx+gQPr8nEA5Sn8UyS5kDltIZ7/rxFlQZmCRGKdHyAlH+z5Ih7tsFa9QjPzehEK1uIz6+njAZu9PYdfbj3P4G4jEeUTjf43IEZE3aAHrO8qB04wsmgFq/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J7iTlzp8jfmxFM6sj2H48rAdpaZzF9UDcomdiQDpYfI=; b=SkLUF6/eDDuf/UJuVBrVGPZxgQheW15y3I1zlqyXMEzcPi6MO0tF8hvMKhqJQT0BTAsjX8FPDnsnGIefW5EeiWWQW/KCKJ9lUSTnTaqNW/7tmfMIcwUvutyC4dj3ikgK0e86eYQCJChjd4Fj4uFwiWdm72ccr0MvPA91qk0rnu7QmOafHIWkWmA5ybrYkW+16Xzrnd3y7hyUIQEjX0iiAh3lsdErAiYPY3cTuVdtsDg1L8cg0pdVZrGmx/KvhhAHd+shST0jVHKro/wb3+TadxTX8kHjAT8czYi4ebWuoK+pelWCwA00ngp3Wco80c+0/mIqyjf8QRaaeUQgOpfLPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J7iTlzp8jfmxFM6sj2H48rAdpaZzF9UDcomdiQDpYfI=; b=KFkXRlLFnIxA093uS5S4eHSpjm/KCwXIU2m3iLLmCtBcxnlqyAuDyWUGaBFOkMWSn9gjfYcEzsKVrW2GZr3WvBzuV/tA9rBx9vDZD8jjUGGNdOKaqL17ReI5VHTVwl0gZL1Fct9jxKWyOkYQZnp20+2e+YBKnRmG5B8uNDVvkU8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYCPR01MB8191.jpnprd01.prod.outlook.com (2603:1096:400:104::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12; Mon, 5 Sep 2022 23:17:44 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6%3]) with mapi id 15.20.5588.018; Mon, 5 Sep 2022 23:17:44 +0000 Message-ID: <87zgfd8l7s.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 2/4] ASoC: soc-dapm.c: don't use WARN_ON() at snd_soc_dai_link_event_pre_pmu() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> References: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Sep 2022 23:17:43 +0000 X-ClientProxiedBy: TY2PR01CA0023.jpnprd01.prod.outlook.com (2603:1096:404:a::35) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae1349db-ac15-4312-d956-08da8f94d641 X-MS-TrafficTypeDiagnostic: TYCPR01MB8191:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dsWKfVuTshoTZG9tmRENr4xAVSfAw+loTJcmxwdZAhnnVKHm9CU6DD9pArmkCGrw7MZz4EEaHqd0QC5YN7pznmGc0BMDVeP4q+y5IjpYfHSSrBI8bmkRTeJ5KOoZDPvjFVKnxYY2JwNQskmawr0O8o73P99E52CxxthXF4I8thCEMycfk9TlrErOsSZN+lJS2l6XtuMj5v4sRG/z/n55jUMZ3rJuCdMgwE1UhYiJ61d3LU77k8bkwsLLa3hUn0wxP0ILht93z8lqx3H/tX35iP8t0OOI/4WPshwr+o3klG5kpAYNCeQ5cVQFc7GsXGf/qVKO5dg1IPDHmbFWEnKL92Hv4+VgKzvQkqYdj064CxmBejuZlO8TYTYfr7ThTLziLKA9Z9sKLkRd56K20r6ZjzSGPIXJrD44rTFCfRVst62kph3QeP8whWi+cmFKtUjp4vrw6EHG+i4Tyb1lrXbVRkOqQ6XMtQeLxcU2E6A1ILG8x7+ZajcmXccoW0/0lSIfnWxUZEsJ8Jb0h37aOGedvrYqlpyiBq1smv7tZjg4h8Q8vh1A+WTPQcpQvWiQcQbdQVkH5f0Mi6WDjj6Y5UP3wWaRNKX58/DM6TzD3uA6llmDc2DmGhKnckZiuzIolX65opexfgiMihiRBoOeqxeyaSm3FdVkTuyXu10TaAIHrDpMM3eu3sRxO19PU861QlKPqI3d22yhUFIaghT6xV3/8tvTeWVbNH69nTdCAPG1UN6Dw6yAQ06yCVnyAtzRUmalZXBm4av27UrKxtQOqG4vwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(396003)(136003)(39860400002)(366004)(8936002)(83380400001)(8676002)(66476007)(66556008)(66946007)(4326008)(6506007)(52116002)(26005)(6512007)(4744005)(41300700001)(2616005)(186003)(86362001)(38100700002)(6916009)(316002)(2906002)(478600001)(6486002)(38350700002)(36756003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Hmy50xCZUpWdLMuNH58bBfzdnLJw8tLpDfUVXp5usS5+cIrACvmACrbeN4tSHSGPjCgu3v7GSUk9/oRde9Qj4S2VkV5meGvnjbh9o4t12rAmUUu2q/RPtedyU6/42/XSoBGMjG1zlpVRiz2HmQxKxPHjRDLzPgplqMuQ7ZxCkfce5FZZyj4F9Jo+mK3ww4qFJ5vad1gkr23+LsImvIv7R1ffMj674C18Ooy7yi9uK3igtOLNiNg2rigoPn1hhq7rwrFOXyfGmZiixIGYQNjVzbZKLpnKQVTP8FjpO8BKxy/zK6quqZ46sznAcOn6cUYAjYL7X87bkavkFGwtaQVCIX+ZmdDtrxFi0alB36KTM07sgtc27fPPptTLOQz3AuGA/96j2aRJV4ctvGuKLJSS4olhKO2bH9JWghOjphOc2Qy6E3q5etzYXDiVDLbkG1vDaC5esdEJZW0W0y7BTL2zin6PA+ggRkGlgPvNCUnzBOIuWERuRnrMwQL/nwowWhVBENvRFHiKt6J98VP7vCNOy0iouwXlA7KJj1KUBsdfcks3tMNkPVT0ADoDjZ97zW9K/eGU9i8cCwrHl3M1Y1dezKeegfml4CJSBnrhebGPJu7F+XynFdIYZbAErX3hKNqBGURhr1NtiCXZkFh10aH6YskKsI3Cfjsntik7e16EA9zusBALtPRy7PBEXRD0ZhjsnQ5p0cLr1XEjXuVTf84GlUy441dQuh+EHItwUrNbwYooZ5C1UdsH+qgO/CxHC8RsUFX3L86fz3hE0fPUDj2Zrc2SVSsWK3Me14cdAxGn0P2fOxafAYpWn1mQKeiLWamIRX3/K/qJCZTK058i96JOW7JZiVoakzKBTC6M3b49x7fKKCHLohLAfNqFqyxA3kdhBLMdGYBHmyNjh3GJgwQSuO5e2wQc3vO8IKS2pYGZvGqmVwiUY3jR7k/3/D/cXJjvcU18vCsvSdWI+p6HDmPG9Cd07YoZlUPIUqBIIgZ5BaTlX9tY+14ZjqHr7hIT/FeH7CXm8MAmzHYpdEfarlLapUZjPddt47qXF1BeSOC5Qi5am0lBy6eIutgpB1tSU4suWS7Y9Iv1DxoF9Q4kksMedcdfqYx43fEnz+7MLpqr426tM039D0bDMxUMEij0TC57Y2wSrbu68dswgmKViyw9ohM8uQY+9AQSaRh0StW3IQhVRAFbrqxZqsZ5bSHsN/RIMZWZ5vn3YXiLeCkqJD5AWbXYCbSv1W6tGAvOmn4pMhhImIQHWVQh5Un+7hjJirEU/Oct9NzSItvW1YYkWc7nOyh2RWVB7htAvopE2oN6Fq5KS5gGCyddUYVss5vyhkByR0Q4uZYWUNRbXk2nyphcQ1uQC4vm5sVpg8bCTRyJ35Gm1yDO3T2iVkRvjc5Q/H9GEavzSleoPg6yJUgHrQdQ+Bs/TIYnUVG/SumEqu+6e6sLpWvqfT0qboyBsHwLfZITo04a9iVJAK9e3PJu+/2S2c4E+Hn+shnG1u6PHY/3SqrYFLSqt8AK9dHqHs7eHAfgZSnzOnIanrsSyu2o8h5RhNBNk4mLngHwyA9OntH2gBcKxankxoTUcEZPDSx+pbPXkpjcIHfjvxHKnnu3bxN3ojOKBfVXta5pSx1ub/GLMLo= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae1349db-ac15-4312-d956-08da8f94d641 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 23:17:44.0066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bgcUgujb+x9nYhwojutryGN/ZS012Mm9sHhI+14A1PEmUQBYJvawnp1JY+YZYL4PKht0c2tdp1OE8zXUiHoR6ECoW/RHraU/JeD/ykqG0ONEnJaLEC9tTbiLO0wBwJH0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB8191 Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Kuninori Morimoto Current snd_soc_dai_link_event_pre_pmu() is checking "config". It is using dev_err() (A) if it was NULL, so we don't need to use WARN_ON() (B) to check it, it is over-kill. This patch removes it. (B) if (WARN_ON(!config)) { (A) dev_err(...); ... } Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7d4e4068f870..bc7d64b570b4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3883,7 +3883,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, * necessary */ config = rtd->dai_link->params + rtd->params_select; - if (WARN_ON(!config)) { + if (!config) { dev_err(w->dapm->dev, "ASoC: link config missing\n"); ret = -EINVAL; goto out; From patchwork Mon Sep 5 23:17:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 12966622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 073E4ECAAA1 for ; Mon, 5 Sep 2022 23:19:20 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3FFED1676; Tue, 6 Sep 2022 01:18:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3FFED1676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1662419958; bh=htIAbLydJv6OOca/NJUypSHPkStF0b65Undmoej1ZZs=; h=From:Subject:To:In-Reply-To:References:Date:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=P/u+PDJL5oDHZ3KF8rSxcUEPQlKJZr/WAmdI+4dzaoKMuqU+iq1+WIKqZv7/WbY3f 4pOwmpjRxNtds60dHRfShvYQcxsIPF4ePodzb+lVIunjYE+fCkQh+WLBqtABeUE/qD LOTzRb2Fi5U93MCiZWHPYxnkwrAQ4lkNJPqbG+hc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6381DF8053B; Tue, 6 Sep 2022 01:18:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E9548F8053C; Tue, 6 Sep 2022 01:18:01 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2097.outbound.protection.outlook.com [40.107.113.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EE5EDF80536 for ; Tue, 6 Sep 2022 01:17:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EE5EDF80536 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="U4Ec/dEP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxVHWnHdM6Q+RQvK29tv9OqwTE7jYIjFnaaqel9NIbQ6i1p0+lD78oCJJRV9iKptA1nxJ90OkJk8zOwRSu7XUkdxeK+624dZ7waK2b6ObBgkZtrAGS4OMr/3qeVzuPmTpiFlowK5X3JYfKbANuf1WS2ZACOnBo6q74lsrYEz8d+fy0DZD8xLTcL1AAOmYjHA7KHxH3wWA661e/9FTSkzweRLWUOxLTe6wpMQBGpB/LHAog+7Owipmim5Vbjx4rFlfIY4lyDGSVGocmSVHfb3yp16Gcto4qr3qX8pIquv7l6kTCibjLza7wX8bXy5bmxZYZU7u3U/N5Am1joLCMnBOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3iASYS0wxgz7KMQ44Xv7z0gXs5PGpxqaGhnwQaWEWsY=; b=j2PfojqnYBLnPq9KBxjG07Bc7bmk4lMgt0awsHfbqiwuzeVFiL3N3mvGlIgi2KoIeQoHu2MPrRq26Jc7+Gi9N+MjKrSZe2T4ybywl/ujPtVMGLGc1iSOy0C3I85eV8Yq93O15z96POyLs1pZXFOSZIVmFtYU6xpHzLzDzBCgm/kSsU5bWXI9gQ2AWgUKunmdTymIHga/moVOACc8CngQFVGuq28uhH5OzJVCwR6qy8KFIJlkwg9ShpvfyKuvQlpLrCWfBsB3G5OZBHwgG2c44/e3+Oaf5ykRbh+Vs7U6cJ2YeBYx+mRAIkSCbYp2n4jL/14DHZ+Dlp6j7ECgZrXyiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3iASYS0wxgz7KMQ44Xv7z0gXs5PGpxqaGhnwQaWEWsY=; b=U4Ec/dEPuqgn7rLwjnspJmjLRh5qOpnkXAqDZhUSDapbw4mYrge4s2Ka08XDHunrHoMB+tSM6sP6Dkcq4WibHMb+7c2Vy2VRrxDnzmORbBi6rHow2qBYt4i4IJjk1bD+8IEIU+nRIszSb5EKyQAqbXR+WGYAO5jx9CU6e8A7b6Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYCPR01MB8191.jpnprd01.prod.outlook.com (2603:1096:400:104::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.12; Mon, 5 Sep 2022 23:17:51 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6%3]) with mapi id 15.20.5588.018; Mon, 5 Sep 2022 23:17:51 +0000 Message-ID: <87y1ux8l7l.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/4] ASoC: soc-dapm.c: tidyup snd_soc_dai_link_event_pre_pmu() User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> References: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Sep 2022 23:17:50 +0000 X-ClientProxiedBy: TY1PR01CA0193.jpnprd01.prod.outlook.com (2603:1096:403::23) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e93185e-f6cb-4ba3-2e7e-08da8f94da75 X-MS-TrafficTypeDiagnostic: TYCPR01MB8191:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hnoBHGMSu5f3SV7Ws7TiuL2Ex3GAEAG02o9oqckn3Lj6JcwHHF0UMgFZrGEUTgdizmPd5dIIE86Zg2FUriAdqq3RX6t6gG7tsDYk5iTIRP64e9qawILI1x7krzcx0HUVGVRJ+aj+/Yzz+XgVsweHCS4BJuDq+6ynOakmnf88TGCLgGJ75AB4QnGF5O2cyAWPGfeqWoOhYstZt0NFvYqACPsZVrjDmYijpZgS1Xh6p7OE7a9wlzo/pRfvXXN12gqlSz6Hyx4BHauYPrJnee98VenCTK76mJNctnTp9rTkYGL3OsrfhgTJO6c6IllP8Q98lU7M965KLpFUidmNHhlYpxt37J6j7kE1Qgh825G06NetxIQRfw6rUGSLzgE3yGhkj/xe69d2FxFjqd+apRYlMOMmgcrtWwophtTriPRNDF0XvAiRj6iROt6FPNUloY+8YfSy1epcKK3PYSuHQb2wEgR0vBBFar3SQXyaEGNpQw5i0+hqp6tbeCZFG49/iOkQVZd01X6K4WwX8PgXMb9wrGcioib2N7+P6Fo/p49s8rMxj6DHGptFZHqbqspASzfD0A/lu0JFUoxn+VBzW1OAysjRb6Zk7IoXE3wRvv9nFOGmEzXj8AW/ql7W87oG9PZ82eR+GK54J0MZPex5PuRNdvz/Ng7DPtgH6P1og0FOO4v6Re/hwCJ5oIKARxZ7d7MgcXNcQJGQW3/CqeVgRYR7twBc3G9PUzP/BCCD6q3ifWse6yiu6zlXxN6hAFvJRUhBvIMdjV2e3axwtvKUk6f9OQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(396003)(136003)(39860400002)(366004)(8936002)(83380400001)(8676002)(66476007)(66556008)(66946007)(4326008)(6506007)(52116002)(26005)(6512007)(41300700001)(2616005)(186003)(86362001)(38100700002)(6916009)(316002)(2906002)(478600001)(6486002)(38350700002)(36756003)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: APec+N5kI1mipoy5Ob5tgXvx/d92gDGJZzamgUdWiDnQrJwnMEv6pMdpbpPqkAD5bmhR8ofr+HVk/WZJe2BVT2WaHy15CkEfKNQbulQwzI09pydlVE6XqaKonTigreza65KL5LE7UbgMjLxWWPu4jcUKMlTA3T3k6mpdoaZz9du703yNgOrpUyqKRL51P4I4dKUFUEB57OefBVA3P4VBheW6ZJ+zqABK9LHephIqcwL3Ml2+cH9h88q2HY2qr6p8uOuAEysJ1guBaVCRoaeVbzzswn7GQVQeIo64dnYdD5JATi8d6gdHemdt/ltEa6LOtWQy/UVt2ZG10Xbh7F8CHi236asu8EWdRmS4VbvWk7hoZP+ShCpUq4ltiDRbaln6uTFnhuGs/QNKlqWLWsT3xLrJzypYCNgrZBKkuf1JIJ3V2AaKhgiw787+N4qWRHNKXsZ5/hgNjJqY2AW5PClswgTbge8HN4hisHp00L6cS76WIYHItRmzJTY7xn4Qg+cDL0vWVj6ODxOxvae9QhZy1txr/TZN3yjEpkzDt0sCRlOcLz50DRYjlyJrm2m9uwleOL2OQRrxQ5/yYZLoxjcVk2aIGemxTPKzoGEXqmoT8qHcjDO2GQHTbgtXAfylvMAKpzs8foHRpxk7LqBiL5+zMyzrT6VWQ90LHeHa3zQ7/nUs1/90/WrvIK6WdiyfGtkbfVQq7eGp1WS202nlInnvJ49DR6jyrKmZLI6+Lr2WIiVci/bxGkUlaXTa+rFSJrxhQuK2fVEA8GOIExaB7ZrdslxW4s3BMk+uqrPAJs3GEBGZCqtGzuFH7H6oMa3RrA2HXWhjTKO1N/HEJpRjxekDcIcoriebAKTgk9Nb+9AXVenKjy4GevoPlsVCHfygeDjnKc/0IG8yN5yr6lNrmXsZtG1nhnpXDrPuZVrZe06AjAFNJB8LFPkt2dO18JLE4rFdSBX0c4Maw4Jwai9OeKDEOeKBMD5pOZOMI3Q/gLR5hAju55nWCbbZVnnLiCCzhDODsxtRFIcU23KiNIntAc0XQS8S3EAOEgQu6jIGrU+x0Ifk6Yu1f2SWXAr1toMFc69HUtHYcHFUHBUmGCtuFB2cKNPpG+BamttQuoBoDPVvxJbuTaoKKpMY5SaWsyf+VDW1W/H/YFgWskHDCToDeWAGsmU8r5GYFnvIQX+K+T7ru32WcJvpv3WcKH38xoolurwE2Fxq3nBMj7H1v9g4ImNelIt5qO6v9V8E4Wi2clhC5IjMZt3O4TJHh9H9R5nYHK2eXJ1jvYc2FFT5CAsERMm6t3+ZwRkSrbMOxf+TQS/maKxib58y512+6r5/84GN1siFTUsPmY/+i6JpdynNtBqiiimBkLcI8KMSeLKk8zKm7eg7Wa9ahRTSqnYPvwwnXAsaABoFLeahKVOTWanjwnIf8LolkrJ1nabTF4LmUflaArYUnxR6oKWyUMJjFNKPvjtAnMys5FzfB0whIorXgveLa2qZI6zQPUm6eA69HWgGUZUwiwH7+K7wBQKk0dcF6mXumhQBB+kYQarSd9kkNBwHOdrvE+EeLqR0tpHT8xU++sJEOCEQe9q33SSuQtL9KiHWMnHv8TKpbYySqbnJSShpw/uSbhmOV43ewIIQd6R7JRE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e93185e-f6cb-4ba3-2e7e-08da8f94da75 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 23:17:51.0484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JcegMM6EosOtlHnRPVHl4Set04kYeNo8me50Mmc12zEhW5yUswsi6EORVqXcEB9HUzelR0hAvIbStfz9/S7UI9FSfYiEjmq28GPKcHsNz+D/q3gHdVkhEHVhpOj+ZVN1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB8191 Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Kuninori Morimoto snd_soc_dai_link_event_pre_pmu() is using if/else for config->formats check, but "else" case is for just error. Unnecessary if/else is not good for readable code. this patch checks if config->formats was zero and call "goto out" in such case. [not readable] if (config->formats) { (A) fmt = ... } else { ... (B) goto err; } [readable] if (!config->formats) { ... (B) goto err; } (A) fmt = ... Moreover, we don't need to indicate config->formats value in error message, because it is zero. => if (config->formats) { ... } else { dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", => config->formats); ... } Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index bc7d64b570b4..e8c813586b53 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3890,16 +3890,14 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, } /* Be a little careful as we don't want to overflow the mask array */ - if (config->formats) { - fmt = ffs(config->formats) - 1; - } else { - dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n", - config->formats); - + if (!config->formats) { + dev_warn(w->dapm->dev, "ASoC: Invalid format was specified\n"); ret = -EINVAL; goto out; } + fmt = ffs(config->formats) - 1; + snd_mask_set(hw_param_mask(¶ms, SNDRV_PCM_HW_PARAM_FORMAT), fmt); hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->min = config->rate_min; hw_param_interval(¶ms, SNDRV_PCM_HW_PARAM_RATE)->max = config->rate_max; From patchwork Mon Sep 5 23:17:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 12966623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9667AECAAD3 for ; Mon, 5 Sep 2022 23:19:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B9016163F; Tue, 6 Sep 2022 01:18:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B9016163F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1662419977; bh=QIRhPr4FbZK4x2KwW/3KrLIno/R2hog+P3urML2T9JY=; h=From:Subject:To:In-Reply-To:References:Date:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bTYixYeTVuqPU63eUL2W/yGTtBHRn4WWaAJVrOkXDzD3rRrn60ICAT6EvMgF8Hq/T toWEvOf3swzfIE12/xRuoMgUKgNPr+KRwJUCCht07wxsfpJoLASvYK/kD3tJzRYx3j gINp8sS8dm5wEqPpeuK9lBr/9USi/rVJdz/xG9w8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E768EF80548; Tue, 6 Sep 2022 01:18:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A610DF80542; Tue, 6 Sep 2022 01:18:10 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2100.outbound.protection.outlook.com [40.107.114.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C6044F80542 for ; Tue, 6 Sep 2022 01:18:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C6044F80542 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="aBck7HRP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e4rmVBAXSLTs++YUkFQf3byVQfEXZFJ9WcZctF5d7j9hAco7nEvTPakLd9E8icgEN/qnKF2MJlVddj4nRABXeYDf1DFGK1UV6tlaXR/ZlE4seb2sPGtTVO1rdJprd8tjFvcl5S+zhO0/U4KfUndcWfnrlfhEg9YMmnrwFMd2jz/hGr1R7OHnIF9o8AZwwwh5Sk5fFN7gnkds+23uN7qTMdVRS7E2eSgXk0aieIfGpNueduJwB49RusIeMk3uvKavPkOoVeCIL2VCXH0pD7OR7SWvbkoj3aq4Mcdc0jKorzaGyaacxzXysogYbWeR0qvcFUkCu4uXcvkSHOPENl8KCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GfpVeaVu68zBJY8TZDXtBE1PfJkmlORwjJqByvsDvXo=; b=lE/d477avvrwyfWQiXuCkMQoIrJxe+fTFYIpSyU2aCyxXeYTPguzWh0VlMXCZyoGV755/bqz4k4O+20Kt+MGS089QTbenSmdixknrbEQmW9zL60MkZlFs9Wx9r2fmvNgluL9APvU780bEGtS82HzfPggvFGE4CtLR75HI0ERlIAk6BmyIefQE8/nX3ClIRsu4EfCNpbvfpfpUYMYDLe8KEe4n1lvT5hnwvB7BRCCpjo2IeXFvaH/s1/N/68Lo3+GYlgtBhWFy2TamirgMsY30QUkzKYO9FP6gQDRrTVVm01l3001ehNBAlKiG1XLKrjMKtV+W10ZQeyIoMNV74su9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GfpVeaVu68zBJY8TZDXtBE1PfJkmlORwjJqByvsDvXo=; b=aBck7HRPgtq5+tyLwFYI+IxFVcLw5g7XUP4Us/Ha+McwdyclI4xIe2NeU9FXmdYfKvWtZSytbpz8L8lCLbX62O+XMx4rRn7Rh0DyBZJmC8zhou+40xl1qVGwdzhbKvCaKHguqNh/Ft8iojnTwIBWXXOxScOMVTRYXHxcwjLE7KM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by TYAPR01MB5852.jpnprd01.prod.outlook.com (2603:1096:404:8053::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Mon, 5 Sep 2022 23:17:58 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::bdab:be26:6e36:88c6%3]) with mapi id 15.20.5588.018; Mon, 5 Sep 2022 23:17:58 +0000 Message-ID: <87wnah8l7e.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/4] ASoC: soc-dapm.c: fixup snd_soc_dapm_new_control_unlocked() error handling User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 To: Mark Brown In-Reply-To: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> References: <8735d59zt9.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Sep 2022 23:17:57 +0000 X-ClientProxiedBy: TYAPR01CA0174.jpnprd01.prod.outlook.com (2603:1096:404:ba::18) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 89987b2c-46b0-4e52-99d6-08da8f94de9a X-MS-TrafficTypeDiagnostic: TYAPR01MB5852:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4nwXM6oLU1ru3MaEI63g9DeynwCW4uLuhNxKHcWXA07GhUuIkLbeerRF9ehoOMvdNCI+J21QX52p07qnSW+O0kAqMW0cE3gJB45ZuIC02B7H15zkTtzU2kS//jcXb7MI2+H/jNmMFVDnr7izb4MNx3viNIMfUDQ6KjAUoqF+7TXaGyVk5Tp5CRKVaKDA0U94zbCXD4ZRKKJrfKW4Pof6xf+g9Wksx0HJFUD47nnur1KRB3+z+y12aDplSDljvfciYa+lSGqnbIEZ8wI97bckVkw6iYsPOodCcWwgj9f72tbXGhtalRQfFWKoKvKRQl6xbs6Eyl4hCpGnfrsgn+ceEwM0YEmkChqj+QeRMVKdTDDFaws9KoehfWmqHl2rRUXTcT7bIjlzA8v3Isytx6dF2OXRhPUZ5d/OesHqkDuVVpvELhUlJIicknGMel8CDFhlV+V/4sIGawzzkq/6i+OXlc3vWd5s1lHawJ3YKrMNoJlHDYtJgS/FsDQwLX7oTaSSiF1uBpYN9asRcNJb6VtSsh6AKWOwx9NDdIQAxVvVbp7/JMY/w++Ot2SUf+jFwqFCcjAeUqIuTdr4pYVbudHepy50HJG0XHQVWgYHySFVJtEFoSIuognn5KU4Syo3KQviTGUC0ZJeeJ/tHPkdLa7NsMKEc7a3TybVObjOMq4bIeWln0xLOUuKNMGiOAeoL91rvqzP4edyGKRiW9MJI1up/kf86kZBa/VSYG9BpOmpIz08uX3k0wCH3WV/OLK6MdYaQQwZfaxG5219Ger+anPo20RmrVVAZKpK2whdyfZflc1FAPwnSITiAiW9RuCrsjca3tfOUJt2GmlgUmRMpDLEow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(366004)(396003)(39850400004)(136003)(8676002)(478600001)(2906002)(6512007)(26005)(66556008)(86362001)(4326008)(186003)(66946007)(52116002)(6486002)(36756003)(41300700001)(6506007)(8936002)(66476007)(2616005)(83380400001)(38350700002)(38100700002)(6916009)(316002)(5660300002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YVLYnRVeZOq5Ws8deCtb5n0B37eLDpESeSMbrykjs5LJ0/G+cy8J63bbVQgaV1pa0dDi3jEoDLDE9SIRQJ1ETh9+XH0fJ1tZ+3auXHS6q1brihgyRxyUChnIIw8zYr0kJZZowqTfraPl9WxoW110RN1bPJlQRZeWJrYEVwjJbeOjVdAHDqhShfK0v/v0iknuaozz1WpMtwpkc7ILJb30p9xVA6Pt4d+nd/tEWde6kcVoqzDWxTs+O2kkXiSSHOWNlw2QAG6k6sYAqMwG6bqS92PTjKCv/6+0lL90hbyQ9bkH0ESicEd+dqrgZAkjwj0Y9MTBw7+WBlEkHmTymfpknYEExAaBMxSSq424gkcXH68Oi/fMOSFiVvDQVSRMfgOyWPcSE4jFzvwyPpYK98nmnUnEX1OA/5Fu8H8R47OCLb0PSyT5MilwiQZbd2GEQVB/04HSTGmvfD6WGMyPvU2gP0SpBxr/52fYZzgmKz4GRH5+xE2sL1ql5OH1hPTVCAJu1Q4QZgfKDyFmy6vpqqqwdnRso332Pd1Y5MwADoxsbRX0her44OSxmVoOAvIGG3Sl/bmk2iTTMBTCgMLAuplZnN+21k1j/EGMJpGX4HKKwXyy1CqLsDcXocZ3/jqpalG14EJUm6cTdZLYByU2BzrTjvTldlk4shFHkYzCpP1JIJHQUSlo1/y0IBSyjJcuZa0j9TqJORG9+4vBcNVCjDUsC3YmEai1uuh9Zip6yzq4KhoL5jE4ZfhBxFHkeLjcLNXB6t8xAuCfdFGm/Dv/DdKr70N+B8mWC7uc9zhpr6BgWqQkN8zgXB+a3hepHJKmBMVdaIGOzj84gI0XlM32VYjMvaHOWCHbw+wg5kk5jfTjYqkhWJFBlTzbGbrZbJBCZFdrwcewWqDleHoiMlprJVgjhpnoCu+IrT9d1C+APgnah+Vif0bEILM+dITuuh0AsA+kzF1hI5V4xNbTZaN+ZhnIC7fuBhaslxNyL5hDHi5K0kHAk84/j43r578lMKcTIa6OdmaYeSGHpvE2R3roVbQWb/qFx+vvEpiNLURevalCdMTO1NbxofL/eS1TstUMW+8zun5w2LUaZe0hZnmhisvKyLs77wdMw6Bk5ow3sNm2A/crH+pShbj4Pz4+BeTvwoWwcbB2II3L/I1ZT47a5QStfozkAjbhEzbUKMPZzRXtGVBceL9pN8kwTCThSp7a1XNBaZyyucBnZ5q3GHGhwrXq9E9bp2o5L2Hcr2+BbVneZabV/ImJG4PJes5RAe8KCehDAEiNyFw1uwwCJXNFj3c5uN5uwbDRI4BKFte+VLZt+vgNw2CVPC93dhtOg8YT4Cl/LAXmC4WDOr4s4IPVknZZh8F4ch+fvw4Eq4sU1C8gIc/ZMJlglu3tlR0eVuv7kdN7A8F0iBo8xT4+PzsC5CmQP7L+DyUyDyT34MMajG41HaUeWnjTib9aSUd0tuG3Rdb0niYsf/yrFbToNk7DfR0wp1bqAMXGMY063OhmhPykApHSg8DFEFiGf8i/2G59pFo7qlCtaO7wG3pxn3HM7OK71AlIKizBg1gH+dU5lHvsvvhY3cutWgUQUBcv0rsBtqto0srwsGFAHTXyg71AT10cut+v96yX70UntiKiJFmLiNU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89987b2c-46b0-4e52-99d6-08da8f94de9a X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2022 23:17:57.9733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sVOvnxaAFL/8rfqDJcDzwwErYB1vmCzKlI4sHzykV0FFQRbo8SEZVJK3ooljZAKHyqTpoi9nhmc48yrtQXhtZt6GkweONusJV2CLwV93BBusEveMvy26FhFV0d1NMwGB X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB5852 Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Kuninori Morimoto Current snd_soc_dapm_new_control_unlocked() error handling is wrong. It is using "goto request_failed" (A), but error message is using "w->name" (B) which is not yet created in such timing. snd_soc_dapm_new_control_unlocked(xxx) { ... switch (w->id) { case xxx: ... if (IS_ERR(...)) { ret = PTR_ERR(...); (A) goto request_failed; } ... } prefix = soc_dapm_prefix(...); if (prefix) (B) w->name = kasprintf(...); else (B) w->name = kstrdup_const(...); ... (A) request_failed: if (ret != -EPROBE_DEFER) (B) dev_err(..., w->name, ...); return ...; } we can create "w->name" at beginning of this function. In such case, we need to call kfree_const(w->name) at error case. This patch do these. Signed-off-by: Kuninori Morimoto --- sound/soc/soc-dapm.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index e8c813586b53..928e3bfe7457 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3630,10 +3630,18 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, enum snd_soc_dapm_direction dir; struct snd_soc_dapm_widget *w; const char *prefix; - int ret; + int ret = -ENOMEM; if ((w = dapm_cnew_widget(widget)) == NULL) - return ERR_PTR(-ENOMEM); + goto cnew_failed; + + prefix = soc_dapm_prefix(dapm); + if (prefix) + w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); + else + w->name = kstrdup_const(widget->name, GFP_KERNEL); + if (!w->name) + goto name_failed; switch (w->id) { case snd_soc_dapm_regulator_supply: @@ -3672,17 +3680,6 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, break; } - prefix = soc_dapm_prefix(dapm); - if (prefix) - w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); - else - w->name = kstrdup_const(widget->name, GFP_KERNEL); - if (w->name == NULL) { - kfree_const(w->sname); - kfree(w); - return ERR_PTR(-ENOMEM); - } - switch (w->id) { case snd_soc_dapm_mic: w->is_ep = SND_SOC_DAPM_EP_SOURCE; @@ -3770,9 +3767,11 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, if (ret != -EPROBE_DEFER) dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", w->name, ret); - + kfree_const(w->name); +name_failed: kfree_const(w->sname); kfree(w); +cnew_failed: return ERR_PTR(ret); }