]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
phy: phy-rockchip-inno-usb2: Use dev_err_probe() in the probe path
authorDragan Simic <dsimic@manjaro.org>
Wed, 21 Jan 2026 01:38:55 +0000 (20:38 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:51 +0000 (11:18 +0100)
[ Upstream commit 40452520850683f6771094ca218ff206d1fcb022 ]

Improve error handling in the probe path by using function dev_err_probe()
instead of function dev_err(), where appropriate.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/d4ccd9fc278fb46ea868406bf77811ee507f0e4e.1725524803.git.dsimic@manjaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Stable-dep-of: e07dea3de508 ("phy: rockchip: inno-usb2: Fix a double free bug in rockchip_usb2phy_probe()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/phy/rockchip/phy-rockchip-inno-usb2.c

index 7639ecc8f8cd08fea5485e4a67b3ac8c15087e3c..4f43b3e0a1362c73f90cf1d82e39b85c24a0e91d 100644 (file)
@@ -424,11 +424,9 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
 
        if (of_property_read_bool(node, "extcon")) {
                edev = extcon_get_edev_by_phandle(rphy->dev, 0);
-               if (IS_ERR(edev)) {
-                       if (PTR_ERR(edev) != -EPROBE_DEFER)
-                               dev_err(rphy->dev, "Invalid or missing extcon\n");
-                       return PTR_ERR(edev);
-               }
+               if (IS_ERR(edev))
+                       return dev_err_probe(rphy->dev, PTR_ERR(edev),
+                                            "invalid or missing extcon\n");
        } else {
                /* Initialize extcon device */
                edev = devm_extcon_dev_allocate(rphy->dev,
@@ -438,10 +436,9 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
                        return -ENOMEM;
 
                ret = devm_extcon_dev_register(rphy->dev, edev);
-               if (ret) {
-                       dev_err(rphy->dev, "failed to register extcon device\n");
-                       return ret;
-               }
+               if (ret)
+                       return dev_err_probe(rphy->dev, ret,
+                                            "failed to register extcon device\n");
        }
 
        rphy->edev = edev;
@@ -1417,10 +1414,8 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
        }
 
        ret = rockchip_usb2phy_clk480m_register(rphy);
-       if (ret) {
-               dev_err(dev, "failed to register 480m output clock\n");
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "failed to register 480m output clock\n");
 
        if (rphy->phy_cfg->phy_tuning) {
                ret = rphy->phy_cfg->phy_tuning(rphy);
@@ -1440,8 +1435,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
 
                phy = devm_phy_create(dev, child_np, &rockchip_usb2phy_ops);
                if (IS_ERR(phy)) {
-                       dev_err_probe(dev, PTR_ERR(phy), "failed to create phy\n");
-                       ret = PTR_ERR(phy);
+                       ret = dev_err_probe(dev, PTR_ERR(phy), "failed to create phy\n");
                        goto put_child;
                }
 
@@ -1478,8 +1472,7 @@ next_child:
                                                "rockchip_usb2phy",
                                                rphy);
                if (ret) {
-                       dev_err(rphy->dev,
-                               "failed to request usb2phy irq handle\n");
+                       dev_err_probe(rphy->dev, ret, "failed to request usb2phy irq handle\n");
                        goto put_child;
                }
        }