diff mbox series

phy: ti: Add missing pm_runtime_disable() in probe function

Message ID 20220105090225.20507-1-linmq006@gmail.com
State Changes Requested
Headers show
Series phy: ti: Add missing pm_runtime_disable() in probe function | expand

Commit Message

Miaoqian Lin Jan. 5, 2022, 9:02 a.m. UTC
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Add missing pm_runtime_disable() for serdes_am654_probe().

Fixes: 71e2f5c ("phy: ti: Add a new SERDES driver for TI's AM654x SoC")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/phy/ti/phy-am654-serdes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

kernel test robot Jan. 5, 2022, 2:16 p.m. UTC | #1
Hi Miaoqian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc8 next-20220105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Miaoqian-Lin/phy-ti-Add-missing-pm_runtime_disable-in-probe-function/20220105-170334
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c9e6606c7fe92b50a02ce51dda82586ebdf99b48
config: riscv-randconfig-r013-20220105 (https://download.01.org/0day-ci/archive/20220105/202201052240.Rjl0xRWG-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/dc404b65a54364bb2937baba85bb37960c514167
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Miaoqian-Lin/phy-ti-Add-missing-pm_runtime_disable-in-probe-function/20220105-170334
        git checkout dc404b65a54364bb2937baba85bb37960c514167
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/phy/ti/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/phy/ti/phy-am654-serdes.c:841:1: warning: unused label 'err_pm_disable' [-Wunused-label]
   err_pm_disable:
   ^~~~~~~~~~~~~~~
   1 warning generated.


vim +/err_pm_disable +841 drivers/phy/ti/phy-am654-serdes.c

   751	
   752	static int serdes_am654_probe(struct platform_device *pdev)
   753	{
   754		struct phy_provider *phy_provider;
   755		struct device *dev = &pdev->dev;
   756		struct device_node *node = dev->of_node;
   757		struct clk_onecell_data *clk_data;
   758		struct serdes_am654 *am654_phy;
   759		struct mux_control *control;
   760		const char *clock_name;
   761		struct regmap *regmap;
   762		void __iomem *base;
   763		struct phy *phy;
   764		int ret;
   765		int i;
   766	
   767		am654_phy = devm_kzalloc(dev, sizeof(*am654_phy), GFP_KERNEL);
   768		if (!am654_phy)
   769			return -ENOMEM;
   770	
   771		base = devm_platform_ioremap_resource(pdev, 0);
   772		if (IS_ERR(base))
   773			return PTR_ERR(base);
   774	
   775		regmap = devm_regmap_init_mmio(dev, base, &serdes_am654_regmap_config);
   776		if (IS_ERR(regmap)) {
   777			dev_err(dev, "Failed to initialize regmap\n");
   778			return PTR_ERR(regmap);
   779		}
   780	
   781		control = devm_mux_control_get(dev, NULL);
   782		if (IS_ERR(control))
   783			return PTR_ERR(control);
   784	
   785		am654_phy->dev = dev;
   786		am654_phy->of_node = node;
   787		am654_phy->regmap = regmap;
   788		am654_phy->control = control;
   789		am654_phy->type = PHY_NONE;
   790	
   791		ret = serdes_am654_regfield_init(am654_phy);
   792		if (ret) {
   793			dev_err(dev, "Failed to initialize regfields\n");
   794			return ret;
   795		}
   796	
   797		platform_set_drvdata(pdev, am654_phy);
   798	
   799		for (i = 0; i < SERDES_NUM_CLOCKS; i++) {
   800			ret = of_property_read_string_index(node, "clock-output-names",
   801							    i, &clock_name);
   802			if (ret) {
   803				dev_err(dev, "Failed to get clock name\n");
   804				return ret;
   805			}
   806	
   807			ret = serdes_am654_clk_register(am654_phy, clock_name, i);
   808			if (ret) {
   809				dev_err(dev, "Failed to initialize clock %s\n",
   810					clock_name);
   811				return ret;
   812			}
   813		}
   814	
   815		clk_data = &am654_phy->clk_data;
   816		clk_data->clks = am654_phy->clks;
   817		clk_data->clk_num = SERDES_NUM_CLOCKS;
   818		ret = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
   819		if (ret)
   820			return ret;
   821	
   822		pm_runtime_enable(dev);
   823	
   824		phy = devm_phy_create(dev, NULL, &ops);
   825		if (IS_ERR(phy)) {
   826			ret = PTR_ERR(phy);
   827			goto clk_err;
   828		}
   829	
   830		phy_set_drvdata(phy, am654_phy);
   831		phy_provider = devm_of_phy_provider_register(dev, serdes_am654_xlate);
   832		if (IS_ERR(phy_provider)) {
   833			ret = PTR_ERR(phy_provider);
   834			goto clk_err;
   835		}
   836	
   837		return 0;
   838	
   839	clk_err:
   840		of_clk_del_provider(node);
 > 841	err_pm_disable:
   842		pm_runtime_disable(dev);
   843		return ret;
   844	}
   845	

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

Patch

diff --git a/drivers/phy/ti/phy-am654-serdes.c b/drivers/phy/ti/phy-am654-serdes.c
index c1211c4f863c..b77ef9e0e0c7 100644
--- a/drivers/phy/ti/phy-am654-serdes.c
+++ b/drivers/phy/ti/phy-am654-serdes.c
@@ -838,7 +838,8 @@  static int serdes_am654_probe(struct platform_device *pdev)
 
 clk_err:
 	of_clk_del_provider(node);
-
+err_pm_disable:
+	pm_runtime_disable(dev);
 	return ret;
 }