* drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
@ 2023-11-20 14:22 Dan Carpenter
2023-11-20 15:02 ` Jia Jie Ho
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-11-20 14:22 UTC (permalink / raw)
To: oe-kbuild, Jia Jie Ho
Cc: lkp, oe-kbuild-all, linux-kernel, Herbert Xu, Jenny Zhang
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
commit: c388f458bc34eb3a5728b67f6614f9375cd99087 hwrng: starfive - Add TRNG driver for StarFive SoC
config: riscv-randconfig-r071-20231112 (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/reproduce)
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
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311160649.3GhKCfhd-lkp@intel.com/
smatch warnings:
drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
vim +/dev_err_probe +303 drivers/char/hw_random/jh7110-trng.c
c388f458bc34eb Jia Jie Ho 2023-01-17 274 static int starfive_trng_probe(struct platform_device *pdev)
c388f458bc34eb Jia Jie Ho 2023-01-17 275 {
c388f458bc34eb Jia Jie Ho 2023-01-17 276 int ret;
c388f458bc34eb Jia Jie Ho 2023-01-17 277 int irq;
c388f458bc34eb Jia Jie Ho 2023-01-17 278 struct starfive_trng *trng;
c388f458bc34eb Jia Jie Ho 2023-01-17 279
c388f458bc34eb Jia Jie Ho 2023-01-17 280 trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
c388f458bc34eb Jia Jie Ho 2023-01-17 281 if (!trng)
c388f458bc34eb Jia Jie Ho 2023-01-17 282 return -ENOMEM;
c388f458bc34eb Jia Jie Ho 2023-01-17 283
c388f458bc34eb Jia Jie Ho 2023-01-17 284 platform_set_drvdata(pdev, trng);
c388f458bc34eb Jia Jie Ho 2023-01-17 285 trng->dev = &pdev->dev;
c388f458bc34eb Jia Jie Ho 2023-01-17 286
c388f458bc34eb Jia Jie Ho 2023-01-17 287 trng->base = devm_platform_ioremap_resource(pdev, 0);
c388f458bc34eb Jia Jie Ho 2023-01-17 288 if (IS_ERR(trng->base))
c388f458bc34eb Jia Jie Ho 2023-01-17 289 return dev_err_probe(&pdev->dev, PTR_ERR(trng->base),
c388f458bc34eb Jia Jie Ho 2023-01-17 290 "Error remapping memory for platform device.\n");
c388f458bc34eb Jia Jie Ho 2023-01-17 291
c388f458bc34eb Jia Jie Ho 2023-01-17 292 irq = platform_get_irq(pdev, 0);
c388f458bc34eb Jia Jie Ho 2023-01-17 293 if (irq < 0)
c388f458bc34eb Jia Jie Ho 2023-01-17 294 return irq;
c388f458bc34eb Jia Jie Ho 2023-01-17 295
c388f458bc34eb Jia Jie Ho 2023-01-17 296 init_completion(&trng->random_done);
c388f458bc34eb Jia Jie Ho 2023-01-17 297 init_completion(&trng->reseed_done);
c388f458bc34eb Jia Jie Ho 2023-01-17 298 spin_lock_init(&trng->write_lock);
c388f458bc34eb Jia Jie Ho 2023-01-17 299
c388f458bc34eb Jia Jie Ho 2023-01-17 300 ret = devm_request_irq(&pdev->dev, irq, starfive_trng_irq, 0, pdev->name,
c388f458bc34eb Jia Jie Ho 2023-01-17 301 (void *)trng);
c388f458bc34eb Jia Jie Ho 2023-01-17 302 if (ret)
c388f458bc34eb Jia Jie Ho 2023-01-17 @303 return dev_err_probe(&pdev->dev, irq,
^^^
Should be "ret". Weird how we're getting this warning in November when
the code is from Jan... Looks like the bug is still their in linux-next
though.
c388f458bc34eb Jia Jie Ho 2023-01-17 304 "Failed to register interrupt handler\n");
c388f458bc34eb Jia Jie Ho 2023-01-17 305
c388f458bc34eb Jia Jie Ho 2023-01-17 306 trng->hclk = devm_clk_get(&pdev->dev, "hclk");
c388f458bc34eb Jia Jie Ho 2023-01-17 307 if (IS_ERR(trng->hclk))
c388f458bc34eb Jia Jie Ho 2023-01-17 308 return dev_err_probe(&pdev->dev, PTR_ERR(trng->hclk),
c388f458bc34eb Jia Jie Ho 2023-01-17 309 "Error getting hardware reference clock\n");
c388f458bc34eb Jia Jie Ho 2023-01-17 310
c388f458bc34eb Jia Jie Ho 2023-01-17 311 trng->ahb = devm_clk_get(&pdev->dev, "ahb");
c388f458bc34eb Jia Jie Ho 2023-01-17 312 if (IS_ERR(trng->ahb))
c388f458bc34eb Jia Jie Ho 2023-01-17 313 return dev_err_probe(&pdev->dev, PTR_ERR(trng->ahb),
c388f458bc34eb Jia Jie Ho 2023-01-17 314 "Error getting ahb reference clock\n");
c388f458bc34eb Jia Jie Ho 2023-01-17 315
c388f458bc34eb Jia Jie Ho 2023-01-17 316 trng->rst = devm_reset_control_get_shared(&pdev->dev, NULL);
c388f458bc34eb Jia Jie Ho 2023-01-17 317 if (IS_ERR(trng->rst))
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
2023-11-20 14:22 drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe' Dan Carpenter
@ 2023-11-20 15:02 ` Jia Jie Ho
0 siblings, 0 replies; 2+ messages in thread
From: Jia Jie Ho @ 2023-11-20 15:02 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all, linux-kernel, Herbert Xu
On 20/11/2023 10:22 pm, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: c42d9eeef8e5ba9292eda36fd8e3c11f35ee065c
> commit: c388f458bc34eb3a5728b67f6614f9375cd99087 hwrng: starfive - Add TRNG driver for StarFive SoC
> config: riscv-randconfig-r071-20231112 (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/config)
> compiler: riscv64-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231116/202311160649.3GhKCfhd-lkp@intel.com/reproduce)
>
> 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
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> | Closes: https://lore.kernel.org/r/202311160649.3GhKCfhd-lkp@intel.com/
>
> smatch warnings:
> drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe'
>
> vim +/dev_err_probe +303 drivers/char/hw_random/jh7110-trng.c
>
> c388f458bc34eb Jia Jie Ho 2023-01-17 274 static int starfive_trng_probe(struct platform_device *pdev)
> c388f458bc34eb Jia Jie Ho 2023-01-17 275 {
> c388f458bc34eb Jia Jie Ho 2023-01-17 276 int ret;
> c388f458bc34eb Jia Jie Ho 2023-01-17 277 int irq;
> c388f458bc34eb Jia Jie Ho 2023-01-17 278 struct starfive_trng *trng;
> c388f458bc34eb Jia Jie Ho 2023-01-17 279
> c388f458bc34eb Jia Jie Ho 2023-01-17 280 trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
> c388f458bc34eb Jia Jie Ho 2023-01-17 281 if (!trng)
> c388f458bc34eb Jia Jie Ho 2023-01-17 282 return -ENOMEM;
> c388f458bc34eb Jia Jie Ho 2023-01-17 283
> c388f458bc34eb Jia Jie Ho 2023-01-17 284 platform_set_drvdata(pdev, trng);
> c388f458bc34eb Jia Jie Ho 2023-01-17 285 trng->dev = &pdev->dev;
> c388f458bc34eb Jia Jie Ho 2023-01-17 286
> c388f458bc34eb Jia Jie Ho 2023-01-17 287 trng->base = devm_platform_ioremap_resource(pdev, 0);
> c388f458bc34eb Jia Jie Ho 2023-01-17 288 if (IS_ERR(trng->base))
> c388f458bc34eb Jia Jie Ho 2023-01-17 289 return dev_err_probe(&pdev->dev, PTR_ERR(trng->base),
> c388f458bc34eb Jia Jie Ho 2023-01-17 290 "Error remapping memory for platform device.\n");
> c388f458bc34eb Jia Jie Ho 2023-01-17 291
> c388f458bc34eb Jia Jie Ho 2023-01-17 292 irq = platform_get_irq(pdev, 0);
> c388f458bc34eb Jia Jie Ho 2023-01-17 293 if (irq < 0)
> c388f458bc34eb Jia Jie Ho 2023-01-17 294 return irq;
> c388f458bc34eb Jia Jie Ho 2023-01-17 295
> c388f458bc34eb Jia Jie Ho 2023-01-17 296 init_completion(&trng->random_done);
> c388f458bc34eb Jia Jie Ho 2023-01-17 297 init_completion(&trng->reseed_done);
> c388f458bc34eb Jia Jie Ho 2023-01-17 298 spin_lock_init(&trng->write_lock);
> c388f458bc34eb Jia Jie Ho 2023-01-17 299
> c388f458bc34eb Jia Jie Ho 2023-01-17 300 ret = devm_request_irq(&pdev->dev, irq, starfive_trng_irq, 0, pdev->name,
> c388f458bc34eb Jia Jie Ho 2023-01-17 301 (void *)trng);
> c388f458bc34eb Jia Jie Ho 2023-01-17 302 if (ret)
> c388f458bc34eb Jia Jie Ho 2023-01-17 @303 return dev_err_probe(&pdev->dev, irq,
> ^^^
> Should be "ret". Weird how we're getting this warning in November when
> the code is from Jan... Looks like the bug is still their in linux-next
> though.
>
I'll submit a patch for this.
Thanks,
Jia Jie
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-20 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-20 14:22 drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn: passing zero to 'dev_err_probe' Dan Carpenter
2023-11-20 15:02 ` Jia Jie Ho
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®