lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260112092645.cmfh7lz7wd5n5fe4@pengutronix.de>
Date: Mon, 12 Jan 2026 10:26:45 +0100
From: Marco Felsch <m.felsch@...gutronix.de>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: oe-kbuild@...ts.linux.dev, Peng Fan <peng.fan@....com>, lkp@...el.com,
	oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
	Shawn Guo <shawnguo@...nel.org>
Subject: Re: drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn:
 'drvdata->ocotp_base' from of_iomap() not released on lines: 139.

On 26-01-12, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   755bc1335e3b116b702205b72eb57b7b8aef2bb2
> commit: 390c01073f5d0bd64db37926ddb232f33b83620d soc: imx8m: Cleanup with adding imx8m_soc_[un]prepare
> config: m68k-randconfig-r072-20260111 (https://download.01.org/0day-ci/archive/20260111/202601111406.ZVV3YaiU-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 14.3.0
> smatch version: v0.5.0-8985-g2614ff1a
> 
> 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 <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202601111406.ZVV3YaiU-lkp@intel.com/
> 
> smatch warnings:
> drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn: 'drvdata->ocotp_base' from of_iomap() not released on lines: 139.
> 
> vim +143 drivers/soc/imx/soc-imx8m.c
> 
> 390c01073f5d0b Peng Fan 2025-04-23  119  static int imx8m_soc_prepare(struct platform_device *pdev, const char *ocotp_compatible)
> 390c01073f5d0b Peng Fan 2025-04-23  120  {
> 390c01073f5d0b Peng Fan 2025-04-23  121  	struct device_node *np __free(device_node) =
> 390c01073f5d0b Peng Fan 2025-04-23  122  		of_find_compatible_node(NULL, NULL, ocotp_compatible);
> 390c01073f5d0b Peng Fan 2025-04-23  123  	struct imx8_soc_drvdata *drvdata = platform_get_drvdata(pdev);
> 390c01073f5d0b Peng Fan 2025-04-23  124  	int ret = 0;
> 390c01073f5d0b Peng Fan 2025-04-23  125  
> 390c01073f5d0b Peng Fan 2025-04-23  126  	if (!np)
> 390c01073f5d0b Peng Fan 2025-04-23  127  		return -EINVAL;
> 390c01073f5d0b Peng Fan 2025-04-23  128  
> 390c01073f5d0b Peng Fan 2025-04-23  129  	drvdata->ocotp_base = of_iomap(np, 0);
> 390c01073f5d0b Peng Fan 2025-04-23  130  	if (!drvdata->ocotp_base)
> 390c01073f5d0b Peng Fan 2025-04-23  131  		return -EINVAL;
> 390c01073f5d0b Peng Fan 2025-04-23  132  
> 390c01073f5d0b Peng Fan 2025-04-23  133  	drvdata->clk = of_clk_get_by_name(np, NULL);
> 390c01073f5d0b Peng Fan 2025-04-23  134  	if (IS_ERR(drvdata->clk)) {
> 390c01073f5d0b Peng Fan 2025-04-23  135  		ret = PTR_ERR(drvdata->clk);
> 390c01073f5d0b Peng Fan 2025-04-23  136  		goto err_clk;
> 390c01073f5d0b Peng Fan 2025-04-23  137  	}
> 390c01073f5d0b Peng Fan 2025-04-23  138  
> 390c01073f5d0b Peng Fan 2025-04-23  139  	return clk_prepare_enable(drvdata->clk);
> 
> Call iounmap() if clk_prepare_enable() fails?

Yes, we need to check the clk_prepare_enable() return as well.

Regards,
  Marco

> 
> 390c01073f5d0b Peng Fan 2025-04-23  140  
> 390c01073f5d0b Peng Fan 2025-04-23  141  err_clk:
> 390c01073f5d0b Peng Fan 2025-04-23  142  	iounmap(drvdata->ocotp_base);
> 390c01073f5d0b Peng Fan 2025-04-23 @143  	return ret;
> 390c01073f5d0b Peng Fan 2025-04-23  144  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 
> 

-- 
#gernperDu 
#CallMeByMyFirstName

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ