From: Mark Brown <broonie@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Kiseok Jo <kiseok.jo@irondevice.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Arnd Bergmann <arnd@arndb.de>,
Tang Bin <tangbin@cmss.chinamobile.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: sma1307: fix uninitialized variable refence
Date: Wed, 13 Nov 2024 13:24:08 +0000 [thread overview]
Message-ID: <ZzSoeF7dnWDw6rqj@finisterre.sirena.org.uk> (raw)
In-Reply-To: <20241113115708.4772-1-arnd@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]
On Wed, Nov 13, 2024 at 12:56:50PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When firmware loading is disabled, gcc warns that the local
> 'fw' variable fails to get initialized:
>
> sound/soc/codecs/sma1307.c: In function 'sma1307_setting_loaded.isra':
> sound/soc/codecs/sma1307.c:1717:12: error: 'fw' is used uninitialized [-Werror=uninitialized]
> 1717 | if (!fw) {
> | ^
> sound/soc/codecs/sma1307.c:1712:32: note: 'fw' was declared here
> 1712 | const struct firmware *fw;
>
> Initialize this to NULL as that is what it gets checked for in
> case of error.
This is just shutting the warning up - looking at the stub the real
issue is that there's a return value from request_firmware() which isn't
being checked, we're checking for the initialisation of fw instead.
There is one path in the actual implementation that returns an error
code without setting fw, though most do. Either this caller should be
updated to check the return code or if checking fw alone is valid (which
TBH does look like the intent) the stub should be updated to set it.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-11-13 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 11:56 Arnd Bergmann
2024-11-13 13:24 ` Mark Brown [this message]
2024-11-13 22:43 ` Arnd Bergmann
2024-11-14 11:33 ` 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=ZzSoeF7dnWDw6rqj@finisterre.sirena.org.uk \
--to=broonie@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=kiseok.jo@irondevice.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tangbin@cmss.chinamobile.com \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®