mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	phy: amlogic: fix error path in phy_g12a_usb3_pcie_probe()
If clk_prepare_enable() fails we call clk_disable_unprepare()
in the error path what results in a warning that the clock
is disabled and unprepared already.
And if we fail later in phy_g12a_usb3_pcie_probe() then we
bail out w/o calling clk_disable_unprepare().
This patch fixes both errors.
Fixes: 36077e16c0 ("phy: amlogic: Add Amlogic G12A USB3 + PCIE Combo PHY Driver")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/8e416f95-1084-ee28-860e-7884f7fa2e32@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									ce88613e5b
								
							
						
					
					
						commit
						2c8045d48d
					
				
					 1 changed files with 12 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -414,19 +414,19 @@ static int phy_g12a_usb3_pcie_probe(struct platform_device *pdev)
 | 
			
		|||
 | 
			
		||||
	ret = clk_prepare_enable(priv->clk_ref);
 | 
			
		||||
	if (ret)
 | 
			
		||||
		goto err_disable_clk_ref;
 | 
			
		||||
		return ret;
 | 
			
		||||
 | 
			
		||||
	priv->reset = devm_reset_control_array_get_exclusive(dev);
 | 
			
		||||
	if (IS_ERR(priv->reset))
 | 
			
		||||
		return PTR_ERR(priv->reset);
 | 
			
		||||
	if (IS_ERR(priv->reset)) {
 | 
			
		||||
		ret = PTR_ERR(priv->reset);
 | 
			
		||||
		goto err_disable_clk_ref;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	priv->phy = devm_phy_create(dev, np, &phy_g12a_usb3_pcie_ops);
 | 
			
		||||
	if (IS_ERR(priv->phy)) {
 | 
			
		||||
		ret = PTR_ERR(priv->phy);
 | 
			
		||||
		if (ret != -EPROBE_DEFER)
 | 
			
		||||
			dev_err(dev, "failed to create PHY\n");
 | 
			
		||||
 | 
			
		||||
		return ret;
 | 
			
		||||
		dev_err_probe(dev, ret, "failed to create PHY\n");
 | 
			
		||||
		goto err_disable_clk_ref;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	phy_set_drvdata(priv->phy, priv);
 | 
			
		||||
| 
						 | 
				
			
			@ -434,8 +434,12 @@ static int phy_g12a_usb3_pcie_probe(struct platform_device *pdev)
 | 
			
		|||
 | 
			
		||||
	phy_provider = devm_of_phy_provider_register(dev,
 | 
			
		||||
						     phy_g12a_usb3_pcie_xlate);
 | 
			
		||||
	if (IS_ERR(phy_provider)) {
 | 
			
		||||
		ret = PTR_ERR(phy_provider);
 | 
			
		||||
		goto err_disable_clk_ref;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return PTR_ERR_OR_ZERO(phy_provider);
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
err_disable_clk_ref:
 | 
			
		||||
	clk_disable_unprepare(priv->clk_ref);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue