Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: amlogic: use devm_clk_get_enabled() to simplify the code

Simplify the code by using devm_clk_get_enabled().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/9308a2a3-e828-bd9d-ab83-a68376aab5c3@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Heiner Kallweit and committed by
Vinod Koul
766ab0de 2e9bffc4

+6 -26
+6 -26
drivers/phy/amlogic/phy-meson-g12a-usb3-pcie.c
··· 388 388 struct phy_g12a_usb3_pcie_priv *priv; 389 389 struct phy_provider *phy_provider; 390 390 void __iomem *base; 391 - int ret; 392 391 393 392 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 394 393 if (!priv) ··· 407 408 if (IS_ERR(priv->regmap_cr)) 408 409 return PTR_ERR(priv->regmap_cr); 409 410 410 - priv->clk_ref = devm_clk_get(dev, "ref_clk"); 411 + priv->clk_ref = devm_clk_get_enabled(dev, "ref_clk"); 411 412 if (IS_ERR(priv->clk_ref)) 412 413 return PTR_ERR(priv->clk_ref); 413 414 414 - ret = clk_prepare_enable(priv->clk_ref); 415 - if (ret) 416 - return ret; 417 - 418 415 priv->reset = devm_reset_control_array_get_exclusive(dev); 419 - if (IS_ERR(priv->reset)) { 420 - ret = PTR_ERR(priv->reset); 421 - goto err_disable_clk_ref; 422 - } 416 + if (IS_ERR(priv->reset)) 417 + return PTR_ERR(priv->reset); 423 418 424 419 priv->phy = devm_phy_create(dev, np, &phy_g12a_usb3_pcie_ops); 425 - if (IS_ERR(priv->phy)) { 426 - ret = PTR_ERR(priv->phy); 427 - dev_err_probe(dev, ret, "failed to create PHY\n"); 428 - goto err_disable_clk_ref; 429 - } 420 + if (IS_ERR(priv->phy)) 421 + return dev_err_probe(dev, PTR_ERR(priv->phy), "failed to create PHY\n"); 430 422 431 423 phy_set_drvdata(priv->phy, priv); 432 424 dev_set_drvdata(dev, priv); 433 425 434 426 phy_provider = devm_of_phy_provider_register(dev, 435 427 phy_g12a_usb3_pcie_xlate); 436 - if (IS_ERR(phy_provider)) { 437 - ret = PTR_ERR(phy_provider); 438 - goto err_disable_clk_ref; 439 - } 440 - 441 - return 0; 442 - 443 - err_disable_clk_ref: 444 - clk_disable_unprepare(priv->clk_ref); 445 - 446 - return ret; 428 + return PTR_ERR_OR_ZERO(phy_provider); 447 429 } 448 430 449 431 static const struct of_device_id phy_g12a_usb3_pcie_of_match[] = {