Commit cf3399b7 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller
Browse files

net: mvpp2: Use devm_clk_get_optional()



Replace open coded variants of devm_clk_get_optional().

Signed-off-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 692b82c5
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
@@ -7435,27 +7435,26 @@ static int mvpp2_probe(struct platform_device *pdev)
			if (err < 0)
				goto err_gop_clk;

			priv->mg_core_clk = devm_clk_get(&pdev->dev, "mg_core_clk");
			priv->mg_core_clk = devm_clk_get_optional(&pdev->dev, "mg_core_clk");
			if (IS_ERR(priv->mg_core_clk)) {
				priv->mg_core_clk = NULL;
			} else {
				err = PTR_ERR(priv->mg_core_clk);
				goto err_mg_clk;
			}

			err = clk_prepare_enable(priv->mg_core_clk);
			if (err < 0)
				goto err_mg_clk;
		}
		}

		priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk");
		priv->axi_clk = devm_clk_get_optional(&pdev->dev, "axi_clk");
		if (IS_ERR(priv->axi_clk)) {
			err = PTR_ERR(priv->axi_clk);
			if (err == -EPROBE_DEFER)
			goto err_mg_core_clk;
			priv->axi_clk = NULL;
		} else {
		}

		err = clk_prepare_enable(priv->axi_clk);
		if (err < 0)
			goto err_mg_core_clk;
		}

		/* Get system's tclk rate */
		priv->tclk = clk_get_rate(priv->pp_clk);
@@ -7552,12 +7551,9 @@ static int mvpp2_probe(struct platform_device *pdev)
	}
err_axi_clk:
	clk_disable_unprepare(priv->axi_clk);

err_mg_core_clk:
	if (priv->hw_version >= MVPP22)
	clk_disable_unprepare(priv->mg_core_clk);
err_mg_clk:
	if (priv->hw_version >= MVPP22)
	clk_disable_unprepare(priv->mg_clk);
err_gop_clk:
	clk_disable_unprepare(priv->gop_clk);