[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241113115708.4772-1-arnd@kernel.org>
Date: Wed, 13 Nov 2024 12:56:50 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Kiseok Jo <kiseok.jo@...ndevice.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Tang Bin <tangbin@...s.chinamobile.com>,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: sma1307: fix uninitialized variable refence
From: Arnd Bergmann <arnd@...db.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.
Fixes: 576c57e6b4c1 ("ASoC: sma1307: Add driver for Iron Device SMA1307")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
sound/soc/codecs/sma1307.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/sma1307.c b/sound/soc/codecs/sma1307.c
index 81638768ac12..9d6a70b9b626 100644
--- a/sound/soc/codecs/sma1307.c
+++ b/sound/soc/codecs/sma1307.c
@@ -1709,7 +1709,7 @@ static void sma1307_check_fault_worker(struct work_struct *work)
static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *file)
{
- const struct firmware *fw;
+ const struct firmware *fw = NULL;
int *data, size, offset, num_mode;
request_firmware(&fw, file, sma1307->dev);
--
2.39.5
Powered by blists - more mailing lists