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

* Re: [PATCH] ASoC: codecs: ab8500: Fix casting of private data
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-04-29  0:47 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Liam Girdwood, Kuninori Morimoto, Charles Keepax, Ola Lilja,
	Christian A. Ehrhardt, Christian A. Ehrhardt, linux-sound,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 541 bytes --]

On Tue, Apr 28, 2026 at 09:22:49PM +0200, Uwe Kleine-König (The Capable Hub) wrote:

> 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?

A filter control is relatively obscure, it sseens entirely likely that
people just never used this feature of the driver.  IIRC it was on some
relatively widely available reference board.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: codecs: ab8500: Fix casting of private data
  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)
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-04-29  0:47 UTC (permalink / raw)
  To: Liam Girdwood, Kuninori Morimoto, Charles Keepax, Ola Lilja,
	Uwe Kleine-König (The Capable Hub)
  Cc: Christian A. Ehrhardt, Christian A. Ehrhardt, linux-sound,
	linux-kernel

On Tue, 28 Apr 2026 21:22:49 +0200, Uwe Kleine-König (The Capable Hub) wrote:
> ASoC: codecs: ab8500: Fix casting of private data

Applied to

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

Thanks!

[1/1] ASoC: codecs: ab8500: Fix casting of private data
      https://git.kernel.org/broonie/sound/c/a201aef1a88b

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


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

* Re: [PATCH] ASoC: codecs: ab8500: Fix casting of private data
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-04-29  5:21 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Kuninori Morimoto, Charles Keepax, Ola Lilja,
	Christian A. Ehrhardt, Christian A. Ehrhardt, linux-sound,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

Hello Mark,

On Wed, Apr 29, 2026 at 09:47:43AM +0900, Mark Brown wrote:
> On Tue, 28 Apr 2026 21:22:49 +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > ASoC: codecs: ab8500: Fix casting of private data
> 
> Applied to
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
> 
> Thanks!
> 
> [1/1] ASoC: codecs: ab8500: Fix casting of private data
>       https://git.kernel.org/broonie/sound/c/a201aef1a88b

Thanks for applying. Sashiko found[1] that I should have written
"private_value" instead of "private_data" in the commit log. I think it's
still understandable as is, but if you want to fixup that would please
the pedant in me.

Best regards
Uwe

[1] https://sashiko.dev/#/patchset/20260428192255.2294705-2-u.kleine-koenig%40baylibre.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: codecs: ab8500: Fix casting of private data
  2026-04-29  5:21   ` Uwe Kleine-König (The Capable Hub)
@ 2026-04-30  6:12     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-04-30  6:12 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Liam Girdwood, Kuninori Morimoto, Charles Keepax, Ola Lilja,
	Christian A. Ehrhardt, Christian A. Ehrhardt, linux-sound,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Wed, Apr 29, 2026 at 07:21:48AM +0200, Uwe Kleine-König (The Capable Hub) wrote:

> Thanks for applying. Sashiko found[1] that I should have written
> "private_value" instead of "private_data" in the commit log. I think it's
> still understandable as is, but if you want to fixup that would please
> the pedant in me.

Sorry, there's already other stuff on top of it (and I generally try to
avoid changing existing commits).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[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