From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B606EC433EF for ; Sat, 9 Jul 2022 07:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiGIHeH (ORCPT ); Sat, 9 Jul 2022 03:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiGIHeG (ORCPT ); Sat, 9 Jul 2022 03:34:06 -0400 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40FC44E621 for ; Sat, 9 Jul 2022 00:34:03 -0700 (PDT) Received: from [192.168.1.18] ([90.11.190.129]) by smtp.orange.fr with ESMTPA id A4yToJjXqN260A4yTo5RSC; Sat, 09 Jul 2022 09:34:01 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sat, 09 Jul 2022 09:34:01 +0200 X-ME-IP: 90.11.190.129 Message-ID: Date: Sat, 9 Jul 2022 09:33:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 3/3] ASoC: amd: fix for variable set but not used warning Content-Language: en-US To: Vijendar Mukunda , broonie@kernel.org, alsa-devel@alsa-project.org Cc: amadeuszx.slawinski@linux.intel.com, Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@amd.com, zhuning@everest-semi.com, kernel test robot , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , open list References: <20220707132613.3150931-1-Vijendar.Mukunda@amd.com> <20220707132613.3150931-3-Vijendar.Mukunda@amd.com> From: Christophe JAILLET In-Reply-To: <20220707132613.3150931-3-Vijendar.Mukunda@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 07/07/2022 à 15:26, Vijendar Mukunda a écrit : > Fix below kernel warning. >>>> sound/soc/amd/acp-es8336.c:200:13: warning: variable 'ret' set but >>>> not used [-Wunused-but-set-variable] > Hi, this patch, looks odd to me. > Signed-off-by: Vijendar Mukunda > Reported-by: kernel test robot > --- > sound/soc/amd/acp-es8336.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/sound/soc/amd/acp-es8336.c b/sound/soc/amd/acp-es8336.c > index 90f4e5809c72..e1479ae684e9 100644 > --- a/sound/soc/amd/acp-es8336.c > +++ b/sound/soc/amd/acp-es8336.c > @@ -206,6 +206,8 @@ static int st_es8336_late_probe(struct snd_soc_card *card) > dev_err(card->dev, "can not find codec dev\n"); The next devm_acpi_dev_add_driver_gpios() will fail, should we return immediately? > > ret = devm_acpi_dev_add_driver_gpios(codec_dev, acpi_es8336_gpios); > + if (ret) > + dev_warn(card->dev, "Failed to add driver gpios\n"); Should we return immediately? > > gpio_pa = gpiod_get_optional(codec_dev, "pa-enable", GPIOD_OUT_LOW); > if (IS_ERR(gpio_pa)) { > @@ -213,6 +215,7 @@ static int st_es8336_late_probe(struct snd_soc_card *card) > "could not get pa-enable GPIO\n"); > gpiod_put(gpio_pa); > put_device(codec_dev); > + return ret; Here, we return 'ret' which is what is returned by devm_acpi_dev_add_driver_gpios(). So there doesn't seem to be a link with this block which checks for gpiod_get_optional() errors. Moreover, returning an error for something that is optional (gpiod_get_optional()) looks strange. Finally, should an error be returned, maybe PTR_ERR(gpio_pa) would be better here. Just my 2c. CJ > } > return 0; > }