diff mbox series

ASoC: tegra: Fix -Wuninitialized in tegra210_amx_platform_probe()

Message ID 20231011-asoc-tegra-fix-uninit-soc_data-v1-1-0ef0ab44cf48@kernel.org
State Accepted
Commit 41cb1126bed152f7679417834ad7ea39f2252dfb
Headers show
Series ASoC: tegra: Fix -Wuninitialized in tegra210_amx_platform_probe() | expand

Commit Message

Nathan Chancellor Oct. 11, 2023, 8:21 p.m. UTC
Clang warns (or errors with CONFIG_WERROR=y):

  sound/soc/tegra/tegra210_amx.c:553:10: error: variable 'soc_data' is uninitialized when used here [-Werror,-Wuninitialized]
    553 |                                             soc_data->regmap_conf);
        |                                             ^~~~~~~~

A refactoring removed the initialization of this variable but its use
was not updated. Use the soc_data value in the amx variable to resolve
the warning and remove the soc_data variable, as it is now entirely
unused.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1943
Fixes: 9958d85968ed ("ASoC: Use device_get_match_data()")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 sound/soc/tegra/tegra210_amx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


---
base-commit: 59825951707eccf92782e109c04772d34fc07eb6
change-id: 20231011-asoc-tegra-fix-uninit-soc_data-fcd0bf50a732

Best regards,

Comments

Mark Brown Oct. 12, 2023, 5:42 p.m. UTC | #1
On Wed, 11 Oct 2023 13:21:51 -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
> 
>   sound/soc/tegra/tegra210_amx.c:553:10: error: variable 'soc_data' is uninitialized when used here [-Werror,-Wuninitialized]
>     553 |                                             soc_data->regmap_conf);
>         |                                             ^~~~~~~~
> 
> A refactoring removed the initialization of this variable but its use
> was not updated. Use the soc_data value in the amx variable to resolve
> the warning and remove the soc_data variable, as it is now entirely
> unused.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: tegra: Fix -Wuninitialized in tegra210_amx_platform_probe()
      commit: 41cb1126bed152f7679417834ad7ea39f2252dfb

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Thierry Reding Oct. 12, 2023, 6:05 p.m. UTC | #2
On Wed, Oct 11, 2023 at 01:21:51PM -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
> 
>   sound/soc/tegra/tegra210_amx.c:553:10: error: variable 'soc_data' is uninitialized when used here [-Werror,-Wuninitialized]
>     553 |                                             soc_data->regmap_conf);
>         |                                             ^~~~~~~~
> 
> A refactoring removed the initialization of this variable but its use
> was not updated. Use the soc_data value in the amx variable to resolve
> the warning and remove the soc_data variable, as it is now entirely
> unused.
> 
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1943
> Fixes: 9958d85968ed ("ASoC: Use device_get_match_data()")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  sound/soc/tegra/tegra210_amx.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I see that Mark was quicker and this is already applied, but just for
the record, this fixes an OOPS that I started seeing recently but hadn't
gotten around to look at more closely, so I guess:

Tested-by: Thierry Reding <treding@nvidia.com>

And thanks!

Thierry
diff mbox series

Patch

diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c
index dd1a2c77c6ea..91e405909e0f 100644
--- a/sound/soc/tegra/tegra210_amx.c
+++ b/sound/soc/tegra/tegra210_amx.c
@@ -535,7 +535,6 @@  static int tegra210_amx_platform_probe(struct platform_device *pdev)
 	struct tegra210_amx *amx;
 	void __iomem *regs;
 	int err;
-	struct tegra210_amx_soc_data *soc_data;
 
 	amx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL);
 	if (!amx)
@@ -550,7 +549,7 @@  static int tegra210_amx_platform_probe(struct platform_device *pdev)
 		return PTR_ERR(regs);
 
 	amx->regmap = devm_regmap_init_mmio(dev, regs,
-					    soc_data->regmap_conf);
+					    amx->soc_data->regmap_conf);
 	if (IS_ERR(amx->regmap)) {
 		dev_err(dev, "regmap init failed\n");
 		return PTR_ERR(amx->regmap);