From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Ola Lilja <ola.o.lilja@stericsson.com>
Cc: "Christian A. Ehrhardt" <christian.ehrhardt@codasip.com>,
"Christian A. Ehrhardt" <lk@c--e.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: codecs: ab8500: Fix casting of private data
Date: Tue, 28 Apr 2026 21:22:49 +0200 [thread overview]
Message-ID: <20260428192255.2294705-2-u.kleine-koenig@baylibre.com> (raw)
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
next reply other threads:[~2026-04-28 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 19:22 Uwe Kleine-König (The Capable Hub) [this message]
2026-04-29 0:47 ` [PATCH] ASoC: codecs: ab8500: Fix casting of private data 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
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=20260428192255.2294705-2-u.kleine-koenig@baylibre.com \
--to=u.kleine-koenig@baylibre.com \
--cc=broonie@kernel.org \
--cc=christian.ehrhardt@codasip.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lk@c--e.de \
--cc=ola.o.lilja@stericsson.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox