public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: ab8500: Fix casting of private data
@ 2026-04-28 19:22 Uwe Kleine-König (The Capable Hub)
  2026-04-29  0:47 ` Mark Brown
  2026-04-29  0:47 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-04-28 19:22 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Kuninori Morimoto, Charles Keepax,
	Ola Lilja
  Cc: Christian A. Ehrhardt, Christian A. Ehrhardt, linux-sound,
	linux-kernel

From: "Christian A. Ehrhardt" <christian.ehrhardt@codasip.com>

ab8500_filter_controls[i].private_value is initialized using

	.private_value = (unsigned long)&(struct filter_control)
		{.count = xcount, .min = xmin, .max = xmax}

thus it's a pointer to a struct filter_control casted to unsigned long.

So to get back that pointer .private_data must be cast back, not its
address.

Fixes: 679d7abdc754 ("ASoC: codecs: Add AB8500 codec-driver")
Signed-off-by: Christian A. Ehrhardt <christian.ehrhardt@codasip.com>
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

note this is untested on actual hardware and was found by Christian using
clang-tidy and code inspection. I'm a bit irritated how/if that driver was used
since it was introduced into v3.6-rc1 in 2012. Maybe this is a hint that the
driver is unused?

Best regards
Uwe

 sound/soc/codecs/ab8500-codec.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index fdda1b747bf7..8ab2e60f80b4 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2496,13 +2496,13 @@ static int ab8500_codec_probe(struct snd_soc_component *component)
 		return status;
 	}
 	fc = (struct filter_control *)
-		&ab8500_filter_controls[AB8500_FILTER_ANC_FIR].private_value;
+		ab8500_filter_controls[AB8500_FILTER_ANC_FIR].private_value;
 	drvdata->anc_fir_values = (long *)fc->value;
 	fc = (struct filter_control *)
-		&ab8500_filter_controls[AB8500_FILTER_ANC_IIR].private_value;
+		ab8500_filter_controls[AB8500_FILTER_ANC_IIR].private_value;
 	drvdata->anc_iir_values = (long *)fc->value;
 	fc = (struct filter_control *)
-		&ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value;
+		ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value;
 	drvdata->sid_fir_values = (long *)fc->value;
 
 	snd_soc_dapm_disable_pin(dapm, "ANC Configure Input");

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-30  6:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 19:22 [PATCH] ASoC: codecs: ab8500: Fix casting of private data Uwe Kleine-König (The Capable Hub)
2026-04-29  0:47 ` Mark Brown
2026-04-29  0:47 ` Mark Brown
2026-04-29  5:21   ` Uwe Kleine-König (The Capable Hub)
2026-04-30  6:12     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox