All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Nathan Chancellor <nathan@kernel.org>,
	lgirdwood@gmail.com, broonie@kernel.org
Cc: Syed.SabaKareem@amd.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()
Date: Thu, 5 Jan 2023 22:34:10 +0530	[thread overview]
Message-ID: <6bb126b7-1cb4-0c4c-d357-fadc3ffdd3f9@amd.com> (raw)
In-Reply-To: <20230105-wsometimes-uninitialized-pci-ps-c-v1-1-4022fd077959@kernel.org>

On 05/01/23 21:23, Nathan Chancellor wrote:
> Clang warns:
>
>   sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
>           default:
>           ^~~~~~~
>   sound/soc/amd/ps/pci-ps.c:239:9: note: uninitialized use occurs here
>           return ret;
>                  ^~~
>   sound/soc/amd/ps/pci-ps.c:190:9: note: initialize the variable 'ret' to silence this warning
>           int ret;
>                  ^
>                   = 0
>   1 error generated.
>
> Return -ENODEV, which matches the debug message's description of this block.
>
> Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic")
> Link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FClangBuiltLinux%2Flinux%2Fissues%2F1779&data=05%7C01%7CVijendar.Mukunda%40amd.com%7Cad26656c3d2f4c75d00208daef350528%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638085308267581104%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eeHVStOIOcy%2FdDISOKlGNeyEwx4i5AtJZmQ5dcNB7XQ%3D&reserved=0
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  sound/soc/amd/ps/pci-ps.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
> index 401cfd0036be..f54b9fd9c3ce 100644
> --- a/sound/soc/amd/ps/pci-ps.c
> +++ b/sound/soc/amd/ps/pci-ps.c
> @@ -217,6 +217,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
>  		break;
>  	default:
>  		dev_dbg(&pci->dev, "No PDM devices found\n");
> +		ret = -ENODEV;
ACP PCI driver supports different configurations. As per design , even  when no child dev
nodes are created , ACP driver probe should be successful. ACP PCI driver probe failure
causes power state transition failures when no child device nodes are created.
We should not return -ENODEV in this case.
return 0 is enough in this case. No need to de-init the ACP.


>  		goto de_init;
>  	}
>  
>
> ---
> base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46
> change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31
>
> Best regards,


WARNING: multiple messages have this Message-ID (diff)
From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Nathan Chancellor <nathan@kernel.org>,
	lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, llvm@lists.linux.dev,
	Syed.SabaKareem@amd.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()
Date: Thu, 5 Jan 2023 22:34:10 +0530	[thread overview]
Message-ID: <6bb126b7-1cb4-0c4c-d357-fadc3ffdd3f9@amd.com> (raw)
In-Reply-To: <20230105-wsometimes-uninitialized-pci-ps-c-v1-1-4022fd077959@kernel.org>

On 05/01/23 21:23, Nathan Chancellor wrote:
> Clang warns:
>
>   sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
>           default:
>           ^~~~~~~
>   sound/soc/amd/ps/pci-ps.c:239:9: note: uninitialized use occurs here
>           return ret;
>                  ^~~
>   sound/soc/amd/ps/pci-ps.c:190:9: note: initialize the variable 'ret' to silence this warning
>           int ret;
>                  ^
>                   = 0
>   1 error generated.
>
> Return -ENODEV, which matches the debug message's description of this block.
>
> Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic")
> Link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FClangBuiltLinux%2Flinux%2Fissues%2F1779&data=05%7C01%7CVijendar.Mukunda%40amd.com%7Cad26656c3d2f4c75d00208daef350528%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638085308267581104%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eeHVStOIOcy%2FdDISOKlGNeyEwx4i5AtJZmQ5dcNB7XQ%3D&reserved=0
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  sound/soc/amd/ps/pci-ps.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
> index 401cfd0036be..f54b9fd9c3ce 100644
> --- a/sound/soc/amd/ps/pci-ps.c
> +++ b/sound/soc/amd/ps/pci-ps.c
> @@ -217,6 +217,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
>  		break;
>  	default:
>  		dev_dbg(&pci->dev, "No PDM devices found\n");
> +		ret = -ENODEV;
ACP PCI driver supports different configurations. As per design , even  when no child dev
nodes are created , ACP driver probe should be successful. ACP PCI driver probe failure
causes power state transition failures when no child device nodes are created.
We should not return -ENODEV in this case.
return 0 is enough in this case. No need to de-init the ACP.


>  		goto de_init;
>  	}
>  
>
> ---
> base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46
> change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31
>
> Best regards,


  reply	other threads:[~2023-01-05 17:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 15:53 [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Nathan Chancellor
2023-01-05 15:53 ` Nathan Chancellor
2023-01-05 17:04 ` Mukunda,Vijendar [this message]
2023-01-05 17:04   ` Mukunda,Vijendar
2023-01-05 17:11   ` [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()m Nathan Chancellor
2023-01-05 17:11     ` Nathan Chancellor
2023-01-05 17:34     ` [PATCH] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Nathan Chancellor
2023-01-05 17:34       ` Nathan Chancellor
2023-01-05 23:39       ` Mukunda,Vijendar
2023-01-05 23:39         ` Mukunda,Vijendar
2023-01-09 16:49 ` Mark Brown
2023-01-09 16:49   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bb126b7-1cb4-0c4c-d357-fadc3ffdd3f9@amd.com \
    --to=vijendar.mukunda@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.