* sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used uninitialized in this function
@ 2018-04-18 11:42 kbuild test robot
2018-04-20 12:34 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2018-04-18 11:42 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: kbuild-all, linux-kernel, Mark Brown, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 3971 bytes --]
Hi Pierre-Louis,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a27fc14219f2e3c4a46ba9177b04d9b52c875532
commit: 4772c16ede522d46219a59646503d2020841a6f4 ASoC: Intel: Kconfig: Simplify-clarify ACPI/PCI dependencies
date: 3 months ago
config: i386-randconfig-b0-04181911 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout 4772c16ede522d46219a59646503d2020841a6f4
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
sound/soc/intel/atom/sst/sst_loader.c: In function 'sst_request_fw':
>> sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used uninitialized in this function [-Wuninitialized]
if (fw == NULL) {
^
vim +/fw +357 sound/soc/intel/atom/sst/sst_loader.c
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 344
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 345 /*
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 346 * sst_request_fw - requests audio fw from kernel and saves a copy
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 347 *
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 348 * This function requests the SST FW from the kernel, parses it and
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 349 * saves a copy in the driver context
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 350 */
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 351 static int sst_request_fw(struct intel_sst_drv *sst)
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 352 {
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 353 int retval = 0;
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 354 const struct firmware *fw;
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 355
5794b7ec sound/soc/intel/sst/sst_loader.c Fang, Yang A 2014-10-30 356 retval = request_firmware(&fw, sst->firmware_name, sst->dev);
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 @357 if (fw == NULL) {
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 358 dev_err(sst->dev, "fw is returning as null\n");
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 359 return -EINVAL;
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 360 }
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 361 if (retval) {
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 362 dev_err(sst->dev, "request fw failed %d\n", retval);
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 363 return retval;
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 364 }
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 365 mutex_lock(&sst->sst_lock);
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 366 retval = sst_cache_and_parse_fw(sst, fw);
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 367 mutex_unlock(&sst->sst_lock);
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 368
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 369 return retval;
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 370 }
9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16 371
:::::: The code at line 357 was first introduced by commit
:::::: 9012c9544eeac485b2193fea721233907f0847fa ASoC: Intel: mrfld - Add DSP load and management
:::::: TO: Vinod Koul <vinod.koul@intel.com>
:::::: CC: Mark Brown <broonie@kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21338 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used uninitialized in this function
2018-04-18 11:42 sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used uninitialized in this function kbuild test robot
@ 2018-04-20 12:34 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-04-20 12:34 UTC (permalink / raw)
To: kbuild test robot, Pierre-Louis Bossart
Cc: kbuild-all, linux-kernel, Mark Brown
On Wed, 2018-04-18 at 19:42 +0800, kbuild test robot wrote:
> sound/soc/intel/atom/sst/sst_loader.c: In function
> 'sst_request_fw':
> > > sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used
> > > uninitialized in this function [-Wuninitialized]
>
> if (fw == NULL) {
> ^
>
Looks like semi-false-positive.
We should check retval first, then check fw. The API has to return an
error in case when fw is not filled correctly.
Otherwise it breaks a rule that input parameters are not altered on
error path (when they are not about error itself of course).
> vim +/fw +357 sound/soc/intel/atom/sst/sst_loader.c
>
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 344
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 345 /*
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 346 * sst_request_fw - requests audio fw from kernel and saves a
> copy
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 347 *
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 348 * This function requests the SST FW from the kernel, parses
> it and
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 349 * saves a copy in the driver context
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 350 */
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 351 static int sst_request_fw(struct intel_sst_drv *sst)
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 352 {
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 353 int retval = 0;
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 354 const struct firmware *fw;
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 355
> 5794b7ec sound/soc/intel/sst/sst_loader.c Fang, Yang A 2014-10-
> 30 356 retval = request_firmware(&fw, sst->firmware_name,
> sst->dev);
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-16
> @357 if (fw == NULL) {
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 358 dev_err(sst->dev, "fw is returning as
> null\n");
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 359 return -EINVAL;
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 360 }
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 361 if (retval) {
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 362 dev_err(sst->dev, "request fw failed %d\n",
> retval);
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 363 return retval;
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 364 }
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 365 mutex_lock(&sst->sst_lock);
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 366 retval = sst_cache_and_parse_fw(sst, fw);
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 367 mutex_unlock(&sst->sst_lock);
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 368
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 369 return retval;
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 370 }
> 9012c954 sound/soc/intel/sst/sst_loader.c Vinod Koul 2014-10-
> 16 371
>
> :::::: The code at line 357 was first introduced by commit
> :::::: 9012c9544eeac485b2193fea721233907f0847fa ASoC: Intel: mrfld -
> Add DSP load and management
>
> :::::: TO: Vinod Koul <vinod.koul@intel.com>
> :::::: CC: Mark Brown <broonie@kernel.org>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all Intel
> Corporation
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-20 12:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 11:42 sound/soc/intel/atom/sst/sst_loader.c:357:9: warning: 'fw' is used uninitialized in this function kbuild test robot
2018-04-20 12:34 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).