drivers/clk/renesas/rzg2l-cpg.c:1222:52-58: opportunity for str_enable_disable(enable)

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Biju Das <[email protected]>
CC: Geert Uytterhoeven <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dd3210c47e8d3ac6b4e9141fc68acc03b38c0ba3
commit: 78db1faa6b681da20ec167268b28778ebb0f98b7 clk: renesas: rzg2l: Add support for enabling PLLs
date:   3 months ago
:::::: branch date: 35 hours ago
:::::: commit date: 3 months ago
config: alpha-randconfig-r062-20260712 (https://download.01.org/0day-ci/archive/20260712/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.4.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
| Fixes: 78db1faa6b68 ("clk: renesas: rzg2l: Add support for enabling PLLs")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> drivers/clk/renesas/rzg2l-cpg.c:1222:52-58: opportunity for str_enable_disable(enable)

vim +1222 drivers/clk/renesas/rzg2l-cpg.c

78db1faa6b681d Biju Das 2026-03-26  1195  
78db1faa6b681d Biju Das 2026-03-26  1196  static int rzg3l_cpg_pll_clk_endisable(struct clk_hw *hw, bool enable)
78db1faa6b681d Biju Das 2026-03-26  1197  {
78db1faa6b681d Biju Das 2026-03-26  1198  	struct pll_clk *pll_clk = to_pll(hw);
78db1faa6b681d Biju Das 2026-03-26  1199  	struct rzg2l_cpg_priv *priv = pll_clk->priv;
78db1faa6b681d Biju Das 2026-03-26  1200  	u32 stby_offset, mon_offset;
78db1faa6b681d Biju Das 2026-03-26  1201  	u32 val, mon_val;
78db1faa6b681d Biju Das 2026-03-26  1202  	int ret;
78db1faa6b681d Biju Das 2026-03-26  1203  
78db1faa6b681d Biju Das 2026-03-26  1204  	stby_offset = RZG3L_PLL_STBY_OFFSET(pll_clk->conf);
78db1faa6b681d Biju Das 2026-03-26  1205  	mon_offset = RZG3L_PLL_MON_OFFSET(pll_clk->conf);
78db1faa6b681d Biju Das 2026-03-26  1206  
78db1faa6b681d Biju Das 2026-03-26  1207  	if (enable) {
78db1faa6b681d Biju Das 2026-03-26  1208  		val = RZG3L_PLL_STBY_RESETB_WEN | RZG3L_PLL_STBY_RESETB;
78db1faa6b681d Biju Das 2026-03-26  1209  		mon_val = RZG3L_PLL_MON_RESETB | RZG3L_PLL_MON_LOCK;
78db1faa6b681d Biju Das 2026-03-26  1210  	} else {
78db1faa6b681d Biju Das 2026-03-26  1211  		val = RZG3L_PLL_STBY_RESETB_WEN;
78db1faa6b681d Biju Das 2026-03-26  1212  		mon_val = 0;
78db1faa6b681d Biju Das 2026-03-26  1213  	}
78db1faa6b681d Biju Das 2026-03-26  1214  
78db1faa6b681d Biju Das 2026-03-26  1215  	writel(val, priv->base + stby_offset);
78db1faa6b681d Biju Das 2026-03-26  1216  
78db1faa6b681d Biju Das 2026-03-26  1217  	/* ensure PLL is in normal/standby mode */
78db1faa6b681d Biju Das 2026-03-26  1218  	ret = readl_poll_timeout_atomic(priv->base + mon_offset, val, mon_val ==
78db1faa6b681d Biju Das 2026-03-26  1219  					(val & (RZG3L_PLL_MON_RESETB | RZG3L_PLL_MON_LOCK)),
78db1faa6b681d Biju Das 2026-03-26  1220  					10, 100);
78db1faa6b681d Biju Das 2026-03-26  1221  	if (ret)
78db1faa6b681d Biju Das 2026-03-26 @1222  		dev_err(priv->dev, "Failed to %s PLL 0x%x/%pC\n", enable ?
78db1faa6b681d Biju Das 2026-03-26  1223  			"enable" : "disable", stby_offset, hw->clk);
78db1faa6b681d Biju Das 2026-03-26  1224  
78db1faa6b681d Biju Das 2026-03-26  1225  	return ret;
78db1faa6b681d Biju Das 2026-03-26  1226  }
78db1faa6b681d Biju Das 2026-03-26  1227  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.