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>] [day] [month] [year] [list]
Message-ID: <202105140611.0pGD90Qg-lkp@intel.com>
Date:   Fri, 14 May 2021 09:04:15 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Neil Armstrong <narmstrong@...libre.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Vinod Koul <vkoul@...nel.org>
Subject: drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c:393
 phy_meson_axg_mipi_dphy_probe() warn: 'priv->clk' not released on lines:
 386.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   315d99318179b9cd5077ccc9f7f26a164c9fa998
commit: 76aefb221146dbe0de124f566329c76d5dcf118a phy: amlogic: Add AXG MIPI D-PHY driver
config: powerpc-randconfig-m031-20210513 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c:393 phy_meson_axg_mipi_dphy_probe() warn: 'priv->clk' not released on lines: 386.

vim +393 drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c

76aefb221146db Neil Armstrong 2020-11-16  333  static int phy_meson_axg_mipi_dphy_probe(struct platform_device *pdev)
76aefb221146db Neil Armstrong 2020-11-16  334  {
76aefb221146db Neil Armstrong 2020-11-16  335  	struct device *dev = &pdev->dev;
76aefb221146db Neil Armstrong 2020-11-16  336  	struct phy_provider *phy_provider;
76aefb221146db Neil Armstrong 2020-11-16  337  	struct resource *res;
76aefb221146db Neil Armstrong 2020-11-16  338  	struct phy_meson_axg_mipi_dphy_priv *priv;
76aefb221146db Neil Armstrong 2020-11-16  339  	struct phy *phy;
76aefb221146db Neil Armstrong 2020-11-16  340  	void __iomem *base;
76aefb221146db Neil Armstrong 2020-11-16  341  	int ret;
76aefb221146db Neil Armstrong 2020-11-16  342  
76aefb221146db Neil Armstrong 2020-11-16  343  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
76aefb221146db Neil Armstrong 2020-11-16  344  	if (!priv)
76aefb221146db Neil Armstrong 2020-11-16  345  		return -ENOMEM;
76aefb221146db Neil Armstrong 2020-11-16  346  
76aefb221146db Neil Armstrong 2020-11-16  347  	priv->dev = dev;
76aefb221146db Neil Armstrong 2020-11-16  348  	platform_set_drvdata(pdev, priv);
76aefb221146db Neil Armstrong 2020-11-16  349  
76aefb221146db Neil Armstrong 2020-11-16  350  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
76aefb221146db Neil Armstrong 2020-11-16  351  	base = devm_ioremap_resource(dev, res);
76aefb221146db Neil Armstrong 2020-11-16  352  	if (IS_ERR(base))
76aefb221146db Neil Armstrong 2020-11-16  353  		return PTR_ERR(base);
76aefb221146db Neil Armstrong 2020-11-16  354  
76aefb221146db Neil Armstrong 2020-11-16  355  	priv->regmap = devm_regmap_init_mmio(dev, base,
76aefb221146db Neil Armstrong 2020-11-16  356  					&phy_meson_axg_mipi_dphy_regmap_conf);
76aefb221146db Neil Armstrong 2020-11-16  357  	if (IS_ERR(priv->regmap))
76aefb221146db Neil Armstrong 2020-11-16  358  		return PTR_ERR(priv->regmap);
76aefb221146db Neil Armstrong 2020-11-16  359  
76aefb221146db Neil Armstrong 2020-11-16  360  	priv->clk = devm_clk_get(dev, "pclk");
76aefb221146db Neil Armstrong 2020-11-16  361  	if (IS_ERR(priv->clk))
76aefb221146db Neil Armstrong 2020-11-16  362  		return PTR_ERR(priv->clk);
76aefb221146db Neil Armstrong 2020-11-16  363  
76aefb221146db Neil Armstrong 2020-11-16  364  	priv->reset = devm_reset_control_get(dev, "phy");
76aefb221146db Neil Armstrong 2020-11-16  365  	if (IS_ERR(priv->reset))
76aefb221146db Neil Armstrong 2020-11-16  366  		return PTR_ERR(priv->reset);
76aefb221146db Neil Armstrong 2020-11-16  367  
76aefb221146db Neil Armstrong 2020-11-16  368  	priv->analog = devm_phy_get(dev, "analog");
76aefb221146db Neil Armstrong 2020-11-16  369  	if (IS_ERR(priv->analog))
76aefb221146db Neil Armstrong 2020-11-16  370  		return PTR_ERR(priv->analog);
76aefb221146db Neil Armstrong 2020-11-16  371  
76aefb221146db Neil Armstrong 2020-11-16  372  	ret = clk_prepare_enable(priv->clk);
76aefb221146db Neil Armstrong 2020-11-16  373  	if (ret)
76aefb221146db Neil Armstrong 2020-11-16  374  		return ret;
76aefb221146db Neil Armstrong 2020-11-16  375  
76aefb221146db Neil Armstrong 2020-11-16  376  	ret = reset_control_deassert(priv->reset);
76aefb221146db Neil Armstrong 2020-11-16  377  	if (ret)
76aefb221146db Neil Armstrong 2020-11-16  378  		return ret;
76aefb221146db Neil Armstrong 2020-11-16  379  
76aefb221146db Neil Armstrong 2020-11-16  380  	phy = devm_phy_create(dev, NULL, &phy_meson_axg_mipi_dphy_ops);
76aefb221146db Neil Armstrong 2020-11-16  381  	if (IS_ERR(phy)) {
76aefb221146db Neil Armstrong 2020-11-16  382  		ret = PTR_ERR(phy);
76aefb221146db Neil Armstrong 2020-11-16  383  		if (ret != -EPROBE_DEFER)
76aefb221146db Neil Armstrong 2020-11-16  384  			dev_err(dev, "failed to create PHY\n");
76aefb221146db Neil Armstrong 2020-11-16  385  
76aefb221146db Neil Armstrong 2020-11-16  386  		return ret;

Should we disable unprepare the clk?  I don't know, btw.  It seems like
a lot of people don't bother with that.

76aefb221146db Neil Armstrong 2020-11-16  387  	}
76aefb221146db Neil Armstrong 2020-11-16  388  
76aefb221146db Neil Armstrong 2020-11-16  389  	phy_set_drvdata(phy, priv);
76aefb221146db Neil Armstrong 2020-11-16  390  
76aefb221146db Neil Armstrong 2020-11-16  391  	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);

Same if devm_of_phy_provider_register() fails I guess.

76aefb221146db Neil Armstrong 2020-11-16  392  
76aefb221146db Neil Armstrong 2020-11-16 @393  	return PTR_ERR_OR_ZERO(phy_provider);
76aefb221146db Neil Armstrong 2020-11-16  394  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ