Skip to content

Commit c48a449

Browse files
arndbbroonie
authored andcommitted
ASoC: sma1307: fix uninitialized variable refence
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; Check the return code from request_firmware() to ensure that the firmware is correctly set, and drop the incorrect release_firmware() on that uninitialized data. Fixes: 576c57e ("ASoC: sma1307: Add driver for Iron Device SMA1307") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20241113175734.2443315-1-arnd@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 07db6d5 commit c48a449

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sound/soc/codecs/sma1307.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,13 +1711,13 @@ static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *fil
17111711
{
17121712
const struct firmware *fw;
17131713
int *data, size, offset, num_mode;
1714+
int ret;
17141715

1715-
request_firmware(&fw, file, sma1307->dev);
1716+
ret = request_firmware(&fw, file, sma1307->dev);
17161717

1717-
if (!fw) {
1718-
dev_err(sma1307->dev, "%s: failed to read \"%s\"\n",
1719-
__func__, setting_file);
1720-
release_firmware(fw);
1718+
if (ret) {
1719+
dev_err(sma1307->dev, "%s: failed to read \"%s\": %pe\n",
1720+
__func__, setting_file, ERR_PTR(ret));
17211721
sma1307->set.status = false;
17221722
return;
17231723
} else if ((fw->size) < SMA1307_SETTING_HEADER_SIZE) {

0 commit comments

Comments
 (0)