mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn: 'drvdata->ocotp_base' from of_iomap() not released on lines: 139.
@ 2026-01-12  7:57 Dan Carpenter
  2026-01-12  9:26 ` Marco Felsch
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-01-12  7:57 UTC (permalink / raw)
  To: oe-kbuild, Peng Fan
  Cc: lkp, oe-kbuild-all, linux-kernel, Shawn Guo, Marco Felsch

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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.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?

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn: 'drvdata->ocotp_base' from of_iomap() not released on lines: 139.
  2026-01-12  7:57 drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn: 'drvdata->ocotp_base' from of_iomap() not released on lines: 139 Dan Carpenter
@ 2026-01-12  9:26 ` Marco Felsch
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Felsch @ 2026-01-12  9:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: oe-kbuild, Peng Fan, lkp, oe-kbuild-all, linux-kernel, Shawn Guo

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@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.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    |

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-12  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-12  7:57 drivers/soc/imx/soc-imx8m.c:143 imx8m_soc_prepare() warn: 'drvdata->ocotp_base' from of_iomap() not released on lines: 139 Dan Carpenter
2026-01-12  9:26 ` Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®