sound/arm/pxa2xx-ac97-lib.c:334 pxa2xx_ac97_hw_probe() warn: passing zero to 'PTR_ERR'
From: Dan Carpenter
Date: Tue Apr 07 2026 - 04:35:33 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7ca6d1cfec80ebe46cc063f3284c5896c344d9a1
commit: c76d50b71e898694c946993eb3c77f50efa97254 ASoC: ac97: Convert to GPIO descriptors
config: microblaze-randconfig-r072-20260404 (https://download.01.org/0day-ci/archive/20260404/202604041426.i2C1xqHk-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 12.5.0
smatch: v0.5.0-9004-gb810ac53
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: c76d50b71e89 ("ASoC: ac97: Convert to GPIO descriptors")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202604041426.i2C1xqHk-lkp@xxxxxxxxx/
smatch warnings:
sound/arm/pxa2xx-ac97-lib.c:334 pxa2xx_ac97_hw_probe() warn: passing zero to 'PTR_ERR'
vim +/PTR_ERR +334 sound/arm/pxa2xx-ac97-lib.c
e21596bba143563 Bill Pemberton 2012-12-06 320 int pxa2xx_ac97_hw_probe(struct platform_device *dev)
9c63634221f6745 Dmitry Baryshkov 2008-09-10 321 {
9c63634221f6745 Dmitry Baryshkov 2008-09-10 322 int ret;
2548e6c76ebfae0 Arnd Bergmann 2019-09-10 323 int irq;
26ade896b6ba3fd Robert Jarzmik 2009-03-15 324
8ff064521f97554 Arnd Bergmann 2019-09-18 325 ac97_reg_base = devm_platform_ioremap_resource(dev, 0);
8ff064521f97554 Arnd Bergmann 2019-09-18 326 if (IS_ERR(ac97_reg_base)) {
8ff064521f97554 Arnd Bergmann 2019-09-18 327 dev_err(&dev->dev, "Missing MMIO resource\n");
8ff064521f97554 Arnd Bergmann 2019-09-18 328 return PTR_ERR(ac97_reg_base);
8ff064521f97554 Arnd Bergmann 2019-09-18 329 }
8ff064521f97554 Arnd Bergmann 2019-09-18 330
be829277ef79aa6 Peng Fan 2026-01-22 331 if (dev->dev.of_node) {
c76d50b71e89869 Peng Fan 2026-01-22 332 /* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
c76d50b71e89869 Peng Fan 2026-01-22 333 rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH);
c76d50b71e89869 Peng Fan 2026-01-22 @334 ret = PTR_ERR(rst_gpio);
This was intended to be PTR_ERR_OR_ZERO(rst_gpio)
c76d50b71e89869 Peng Fan 2026-01-22 335 if (ret == -ENOENT)
be829277ef79aa6 Peng Fan 2026-01-22 336 reset_gpio = -1;
c76d50b71e89869 Peng Fan 2026-01-22 337 else if (ret)
c76d50b71e89869 Peng Fan 2026-01-22 338 return ret;
Otherwise we always return here.
c76d50b71e89869 Peng Fan 2026-01-22 339 reset_gpio = desc_to_gpio(rst_gpio);
26ade896b6ba3fd Robert Jarzmik 2009-03-15 340 } else {
26ade896b6ba3fd Robert Jarzmik 2009-03-15 341 if (cpu_is_pxa27x())
26ade896b6ba3fd Robert Jarzmik 2009-03-15 342 reset_gpio = 113;
26ade896b6ba3fd Robert Jarzmik 2009-03-15 343 }
9c63634221f6745 Dmitry Baryshkov 2008-09-10 344
9d1cf39be670976 Dmitry Baryshkov 2008-09-10 345 if (cpu_is_pxa27x()) {
3b4bc7bccc78572 Mike Dunn 2013-01-07 346 /*
3b4bc7bccc78572 Mike Dunn 2013-01-07 347 * This gpio is needed for a work-around to a bug in the ac97
3b4bc7bccc78572 Mike Dunn 2013-01-07 348 * controller during warm reset. The direction and level is set
3b4bc7bccc78572 Mike Dunn 2013-01-07 349 * here so that it is an output driven high when switching from
3b4bc7bccc78572 Mike Dunn 2013-01-07 350 * AC97_nRESET alt function to generic gpio.
3b4bc7bccc78572 Mike Dunn 2013-01-07 351 */
c76d50b71e89869 Peng Fan 2026-01-22 352 gpiod_set_consumer_name(rst_gpio, "pxa27x ac97 reset");
053fe0f166e540a Mike Dunn 2013-01-07 353 pxa27x_configure_ac97reset(reset_gpio, false);
3b4bc7bccc78572 Mike Dunn 2013-01-07 354
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki