Re: [PATCH v2 2/4] hwrng: stm32 - implement support for STM32MP25x platforms

From: kernel test robot
Date: Tue Oct 15 2024 - 02:47:53 EST


Hi Gatien,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 1d227fcc72223cbdd34d0ce13541cbaab5e0d72f]

url: https://github.com/intel-lab-lkp/linux/commits/Gatien-Chevallier/dt-bindings-rng-add-st-stm32mp25-rng-support/20241011-234913
base: 1d227fcc72223cbdd34d0ce13541cbaab5e0d72f
patch link: https://lore.kernel.org/r/20241011-rng-mp25-v2-v2-2-76fd6170280c%40foss.st.com
patch subject: [PATCH v2 2/4] hwrng: stm32 - implement support for STM32MP25x platforms
config: nios2-randconfig-r053-20241015 (https://download.01.org/0day-ci/archive/20241015/202410151421.5UhVRFdF-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 14.1.0

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410151421.5UhVRFdF-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/char/hw_random/stm32-rng.c:585:6-12: inconsistent IS_ERR and PTR_ERR on line 586.

vim +585 drivers/char/hw_random/stm32-rng.c

530
531 static int stm32_rng_probe(struct platform_device *ofdev)
532 {
533 struct device *dev = &ofdev->dev;
534 struct device_node *np = ofdev->dev.of_node;
535 struct stm32_rng_private *priv;
536 struct resource *res;
537
538 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
539 if (!priv)
540 return -ENOMEM;
541
542 priv->base = devm_platform_get_and_ioremap_resource(ofdev, 0, &res);
543 if (IS_ERR(priv->base))
544 return PTR_ERR(priv->base);
545
546 priv->rst = devm_reset_control_get(&ofdev->dev, NULL);
547 if (!IS_ERR(priv->rst)) {
548 reset_control_assert(priv->rst);
549 udelay(2);
550 reset_control_deassert(priv->rst);
551 }
552
553 priv->ced = of_property_read_bool(np, "clock-error-detect");
554 priv->lock_conf = of_property_read_bool(np, "st,rng-lock-conf");
555 priv->dev = dev;
556
557 priv->data = of_device_get_match_data(dev);
558 if (!priv->data)
559 return -ENODEV;
560
561 dev_set_drvdata(dev, priv);
562
563 priv->rng.name = dev_driver_string(dev);
564 priv->rng.init = stm32_rng_init;
565 priv->rng.read = stm32_rng_read;
566 priv->rng.quality = 900;
567
568 if (!priv->data->nb_clock || priv->data->nb_clock > 2)
569 return -EINVAL;
570
571 priv->clk_bulk = devm_kzalloc(dev, priv->data->nb_clock * sizeof(*priv->clk_bulk),
572 GFP_KERNEL);
573 if (!priv->clk_bulk)
574 return -ENOMEM;
575
576 if (priv->data->nb_clock == 2) {
577 struct clk *clk;
578 struct clk *bus_clk;
579
580 clk = devm_clk_get(&ofdev->dev, "core");
581 if (IS_ERR(clk))
582 return PTR_ERR(clk);
583
584 bus_clk = devm_clk_get(&ofdev->dev, "bus");
> 585 if (IS_ERR(clk))
> 586 return PTR_ERR(bus_clk);
587
588 priv->clk_bulk[0].clk = clk;
589 priv->clk_bulk[0].id = "core";
590 priv->clk_bulk[1].clk = bus_clk;
591 priv->clk_bulk[1].id = "bus";
592 } else {
593 struct clk *clk;
594
595 clk = devm_clk_get(&ofdev->dev, NULL);
596 if (IS_ERR(clk))
597 return PTR_ERR(clk);
598
599 priv->clk_bulk[0].clk = clk;
600 priv->clk_bulk[0].id = "core";
601 }
602
603 pm_runtime_set_autosuspend_delay(dev, 100);
604 pm_runtime_use_autosuspend(dev);
605 pm_runtime_enable(dev);
606
607 return devm_hwrng_register(dev, &priv->rng);
608 }
609

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki