Re: [PATCH v1] clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: "Onur Özkan" <[email protected]>
TO: [email protected]
TO: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: "Onur Özkan" <[email protected]>

Hi Onur,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux-review/Daniel-Almeida/rust-clk-use-the-type-state-pattern/20260706-224926]

url:    https://github.com/intel-lab-lkp/linux/commits/Onur-zkan/clk-devres-fix-cleanup-in-devm_clk_get_optional_enabled_with_rate/20260805-211528
base:   https://github.com/intel-lab-lkp/linux Daniel-Almeida/rust-clk-use-the-type-state-pattern/20260706-224926
patch link:    https://lore.kernel.org/r/20260801111637.304590-1-work%40onurozkan.dev
patch subject: [PATCH v1] clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: parisc-randconfig-r071-20260808 (https://download.01.org/0day-ci/archive/20260809/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9187-g5189e3fb

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/clk/clk-devres.c:134 devm_clk_get_optional_enabled_with_rate() warn: 'clk' from clk_prepare_enable() not released on lines: 134.

vim +/clk +134 drivers/clk/clk-devres.c

1c34a54a924f326 Onur Özkan          2026-08-01  106  
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  107  struct clk *devm_clk_get_optional_enabled_with_rate(struct device *dev,
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  108  						    const char *id,
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  109  						    unsigned long rate)
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  110  {
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  111  	struct clk *clk;
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  112  	int ret;
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  113  
1c34a54a924f326 Onur Özkan          2026-08-01  114  	clk = devm_clk_get_optional(dev, id);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  115  	if (IS_ERR(clk))
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  116  		return ERR_CAST(clk);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  117  
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  118  	ret = clk_set_rate(clk, rate);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  119  	if (ret)
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  120  		goto out_put_clk;
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  121  
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  122  	ret = clk_prepare_enable(clk);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  123  	if (ret)
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  124  		goto out_put_clk;
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  125  
1c34a54a924f326 Onur Özkan          2026-08-01  126  	ret = devm_add_action_or_reset(dev, devm_clk_disable_unprepare, clk);
1c34a54a924f326 Onur Özkan          2026-08-01  127  	if (ret)
1c34a54a924f326 Onur Özkan          2026-08-01  128  		goto out_put_clk;
1c34a54a924f326 Onur Özkan          2026-08-01  129  
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  130  	return clk;
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  131  
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  132  out_put_clk:
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  133  	devm_clk_put(dev, clk);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05 @134  	return ERR_PTR(ret);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  135  }
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  136  EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled_with_rate);
9934a1bd45b2b03 Bartosz Golaszewski 2024-08-05  137  

--
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.