Re: [PATCH 1/6] pmdomain: rockchip: fix rockchip_pd_power error handling

Dan Carpenter
2025-01-06T09:56:07Z

Hi Peter,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Peter-Geis/pmdomain-rockchip-fix-rockchip_pd_power-error-handling/20241210-093424
base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
patch link: https://lore.kernel.org/r/20241210013010.81257-2-pgwipeout%40gmail.com
patch subject: [PATCH 1/6] pmdomain: rockchip: fix rockchip_pd_power error handling
config: powerpc-randconfig-r072-20241223 (https://download.01.org/0day-ci/archive/20241224/202412240015.MfjYhpNz-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 14.2.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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202412240015.MfjYhpNz-lkp@intel.com/

smatch warnings:
drivers/pmdomain/rockchip/pm-domains.c:614 rockchip_pd_power() warn: inconsistent returns '&pmu->mutex'.

vim +614 drivers/pmdomain/rockchip/pm-domains.c

7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 572 static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 573 {
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 574 struct rockchip_pmu *pmu = pd->pmu;
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 575 int ret;
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 576
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 577 mutex_lock(&pmu->mutex);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 578
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 579 if (rockchip_pmu_domain_is_on(pd) != power_on) {
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 580 ret = clk_bulk_enable(pd->num_clks, pd->clks);
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 581 if (ret < 0) {
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 582 dev_err(pmu->dev, "failed to enable clocks\n");
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 583 mutex_unlock(&pmu->mutex);
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 584 return ret;
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 585 }
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 586
8b579881de295d drivers/pmdomain/rockchip/pm-domains.c Detlev Casanova 2024-08-29 587 rockchip_pmu_ungate_clk(pd, true);
8b579881de295d drivers/pmdomain/rockchip/pm-domains.c Detlev Casanova 2024-08-29 588
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 589 if (!power_on) {
074c6a422d86ff drivers/soc/rockchip/pm_domains.c Elaine Zhang 2016-04-14 590 rockchip_pmu_save_qos(pd);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 591
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 592 /* if powering down, idle request to NIU first */
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 593 ret = rockchip_pmu_set_idle_request(pd, true);
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 594 if (ret < 0)
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 595 return ret;

mutex_unlock(&pmu->mutex);

7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 596 }
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 597
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 598 rockchip_do_pmu_set_power_domain(pd, power_on);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 599
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 600 if (power_on) {
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 601 /* if powering up, leave idle mode */
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 602 ret = rockchip_pmu_set_idle_request(pd, false);
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 603 if (ret < 0)
a15817772c0ae6 drivers/pmdomain/rockchip/pm-domains.c Peter Geis 2024-12-10 604 return ret;

mutex_unlock(&pmu->mutex);

7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 605
074c6a422d86ff drivers/soc/rockchip/pm_domains.c Elaine Zhang 2016-04-14 606 rockchip_pmu_restore_qos(pd);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 607 }
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 608
8b579881de295d drivers/pmdomain/rockchip/pm-domains.c Detlev Casanova 2024-08-29 609 rockchip_pmu_ungate_clk(pd, false);
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 610 clk_bulk_disable(pd->num_clks, pd->clks);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 611 }
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 612
d909072d0521a8 drivers/soc/rockchip/pm_domains.c Jeffy Chen 2018-02-28 613 mutex_unlock(&pmu->mutex);
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 @614 return 0;
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 615 }
7c696693a4f54d drivers/soc/rockchip/pm_domains.c Caesar Wang 2015-09-08 616

--
0-DAY CI Kernel Test Service