From: Dan Carpenter <dan.carpenter@linaro.org>
To: xiazhengqiao@huaqin.corp-partner.google.com
Cc: alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org
Subject: [bug report] ASoC: mediatek: mt8186_mt6366_rt1019_rt5682s: add rt5650 support
Date: Tue, 24 Oct 2023 12:50:33 +0300 [thread overview]
Message-ID: <de95f385-3eb0-44c0-bb71-c9bc993b55be@moroto.mountain> (raw)
Hello xiazhengqiao,
The patch d88c43383101: "ASoC: mediatek:
mt8186_mt6366_rt1019_rt5682s: add rt5650 support" from Oct 19, 2023
(linux-next), leads to the following Smatch static checker warning:
sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c:198 mt8186_rt5682s_init()
warn: does endianness matter for 'type'?
sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c
161 static int mt8186_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
162 {
163 struct snd_soc_component *cmpnt_afe =
164 snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
165 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(cmpnt_afe);
166 struct mtk_soc_card_data *soc_card_data =
167 snd_soc_card_get_drvdata(rtd->card);
168 struct mt8186_mt6366_rt1019_rt5682s_priv *priv = soc_card_data->mach_priv;
169 struct snd_soc_jack *jack = &priv->headset_jack;
170 struct snd_soc_component *cmpnt_codec =
171 snd_soc_rtd_to_codec(rtd, 0)->component;
172 int ret;
173 int type;
174
175 ret = mt8186_dai_i2s_set_share(afe, "I2S1", "I2S0");
176 if (ret) {
177 dev_err(rtd->dev, "Failed to set up shared clocks\n");
178 return ret;
179 }
180
181 ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
182 SND_JACK_HEADSET | SND_JACK_BTN_0 |
183 SND_JACK_BTN_1 | SND_JACK_BTN_2 |
184 SND_JACK_BTN_3,
185 jack, mt8186_jack_pins,
186 ARRAY_SIZE(mt8186_jack_pins));
187 if (ret) {
188 dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
189 return ret;
190 }
191
192 snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
193 snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
194 snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
195 snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
196
197 type = SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_3;
--> 198 return snd_soc_component_set_jack(cmpnt_codec, jack, (void *)&type);
This is an unpublished Smatch check where I manually review casts to see
if they are correct. Quite often they aren't because of an endian bug
or a 64 bit vs 32 bit issue.
Here it's not clear to me what's happening. Normally with this sort of
pass a void pointer code, you can tie it very easily to the same driver.
But in this case it's much more difficult.
There are two functions which use the void *data pointer,
rt5640_set_jack() and rt5645_component_set_jack(). One takes an int and
the other takes a struct rt5640_set_jack_data pointer. So presumably
we know that the cmpnt_codec->driver->set_jack points to
rt5645_component_set_jack(). But how do we know that?
Is there a trick for me as a reviewer to use?
199 }
regards,
dan carpenter
next reply other threads:[~2023-10-24 9:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 9:50 Dan Carpenter [this message]
[not found] ` <CADYyEwSMB9QQCZVuTC=+m8wZJFxkXzzZPhV6wv2-TsZAXa1j8A@mail.gmail.com>
2023-10-25 4:53 ` [bug report] ASoC: mediatek: mt8186_mt6366_rt1019_rt5682s: add rt5650 support Dan Carpenter
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=de95f385-3eb0-44c0-bb71-c9bc993b55be@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=xiazhengqiao@huaqin.corp-partner.google.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