Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
To: Takashi Iwai <tiwai@suse.de>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	patches@opensource.wolfsonmicro.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Daniel Mack <daniel@zonque.org>, Wolfram Sang <wsa@the-dreams.de>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	Matt Reimer <mreimer@sdgsystems.com>
Subject: Re: [PATCH] ASoC: codecs: use SNDRV_PCM_FMTBIT_* for format bitmask
Date: Tue, 26 May 2015 16:03:17 +0200	[thread overview]
Message-ID: <55647D25.80807@maciej.szmigiero.name> (raw)
In-Reply-To: <s5h382j29ey.wl-tiwai@suse.de>

Hello Takashi,

W dniu 26.05.2015 07:29, Takashi Iwai pisze:
> At Sat, 23 May 2015 18:32:29 +0200,
> Maciej S. Szmigiero wrote:
>>
>> snd_soc_pcm_stream.formats is a bitmask of SNDRV_PCM_FMTBIT_*,
>> not of SNDRV_PCM_FORMAT_* (which are sequential integers),
>> however some of ASoC CODEC drivers use these values instead.
>>
>> Found out by sparse on 0-day kernel tester.
>>
>> Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
> 
> Wow, that made me wonder how these drivers could actually work.

Maybe, by coincidence, the wrong defines contained enough bits
set to actually select some common, working format with their
controllers?

> BTW, how did you detect it?  Any static analyzer like sparse or
> smatch?  sparse didn't detect it at the last time I tried, IIRC...

I've received an e-mail from "kbuild test robot" at
"0-DAY kernel test infrastructure" that automated testing there
using sparse found this issue on wm9713 and stac9766 CODECs.

The exact warning was:
>> sound/soc/codecs/stac9766.c:324:28: sparse: incorrect type in initializer (different base types)
   sound/soc/codecs/stac9766.c:324:28:    expected unsigned long long [unsigned] [usertype] formats
   sound/soc/codecs/stac9766.c:324:28:    got restricted snd_pcm_format_t [usertype] <noident>

What is important the warning doesn't show unless a check build
is made with CF=-D__CHECK_ENDIAN__ .

Upon checking I've found the same issue also in two other CODECs,
which aren't normally being built on x86_64 (target architecture
for above automated build) even when SND_SOC_ALL_CODECS is selected.

> thanks,
> 
> Takashi

Best regards,
Maciej Szmigiero

  parent reply	other threads:[~2015-05-26 14:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-23 16:32 [PATCH] ASoC: codecs: use SNDRV_PCM_FMTBIT_* for format bitmask Maciej S. Szmigiero
2015-05-25  8:49 ` Charles Keepax
2015-05-25 12:00 ` Mark Brown
2015-05-26  5:29 ` Takashi Iwai
2015-05-26  9:44   ` Mark Brown
2015-05-26 14:03   ` Maciej S. Szmigiero [this message]
2015-05-26 14:09     ` Takashi Iwai
2015-05-27 12:04       ` Maciej S. Szmigiero

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=55647D25.80807@maciej.szmigiero.name \
    --to=mail@maciej.szmigiero.name \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=daniel@zonque.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mreimer@sdgsystems.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    --cc=wsa@the-dreams.de \
    /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