[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9e60d3b-77db-4b5d-ae63-b5454f61a59f@suswa.mountain>
Date: Mon, 20 Nov 2023 09:22:03 -0500
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Jia Jie Ho <jiajie.ho@...rfivetech.com>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>,
Jenny Zhang <jenny.zhang@...rfivetech.com>
Subject: drivers/char/hw_random/jh7110-trng.c:303 starfive_trng_probe() warn:
passing zero to 'dev_err_probe'
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@...el.com>
| Reported-by: Dan Carpenter <error27@...il.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
Powered by blists - more mailing lists