Skip to contentSkip to conversation

ASoC: mediatek: mt8189: remove unnecessary NULL check

PATCH In review Dan Carpenter 2 participants 2 messages Nov 26, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: mediatek: mt8189: remove unnecessary NULL check

Smatch complains that the call to snd_soc_component_get_drvdata(component) will dereference "component" so this NULL check is too late. The probe() function will never be called with a NULL component pointer so just delete the check.

---
 sound/soc/mediatek/mt8189/mt8189-afe-pcm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8189/mt8189-afe-pcm.c +4 -6
index dcee8e11eca8..166ece74270e 100644
@@ -2352,12 +2352,10 @@ static int mt8189_afe_component_probe(struct snd_soc_component *component)
 {
 	struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
 
-	if (component) {
-		/* enable clock for regcache get default value from hw */
-		pm_runtime_get_sync(afe->dev);
-		mtk_afe_add_sub_dai_control(component);
-		pm_runtime_put_sync(afe->dev);
-	}
+	/* enable clock for regcache get default value from hw */
+	pm_runtime_get_sync(afe->dev);
+	mtk_afe_add_sub_dai_control(component);
+	pm_runtime_put_sync(afe->dev);
 
 	return 0;
 }
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 6 lines · Dan Carpenter

Smatch complains that the call to snd_soc_component_get_drvdata(component) will dereference "component" so this NULL check is too late. The probe() function will never be called with a NULL component pointer so just delete the check.

Applied to

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

Thanks!

[1/1] ASoC: mediatek: mt8189: remove unnecessary NULL check

      commit: 9d3fcd0ebe91c2079b4aeaffc7493a0bb2ad45f2

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