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

Dan Carpenter
2021-06-22T12:57:23Z

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

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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,393.

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);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Is this worth unwinding if we hit an error later on? I doubt it really
matters. #StaticCheckerProblems

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;
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);
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