Skip to content

Commit 10f0711

Browse files
Dragan Simicgregkh
authored andcommitted
phy: phy-rockchip-inno-usb2: Use dev_err_probe() in the probe path
[ Upstream commit 4045252 ] 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: e07dea3 ("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>
1 parent c5b13f0 commit 10f0711

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

drivers/phy/rockchip/phy-rockchip-inno-usb2.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,9 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
424424

425425
if (of_property_read_bool(node, "extcon")) {
426426
edev = extcon_get_edev_by_phandle(rphy->dev, 0);
427-
if (IS_ERR(edev)) {
428-
if (PTR_ERR(edev) != -EPROBE_DEFER)
429-
dev_err(rphy->dev, "Invalid or missing extcon\n");
430-
return PTR_ERR(edev);
431-
}
427+
if (IS_ERR(edev))
428+
return dev_err_probe(rphy->dev, PTR_ERR(edev),
429+
"invalid or missing extcon\n");
432430
} else {
433431
/* Initialize extcon device */
434432
edev = devm_extcon_dev_allocate(rphy->dev,
@@ -438,10 +436,9 @@ static int rockchip_usb2phy_extcon_register(struct rockchip_usb2phy *rphy)
438436
return -ENOMEM;
439437

440438
ret = devm_extcon_dev_register(rphy->dev, edev);
441-
if (ret) {
442-
dev_err(rphy->dev, "failed to register extcon device\n");
443-
return ret;
444-
}
439+
if (ret)
440+
return dev_err_probe(rphy->dev, ret,
441+
"failed to register extcon device\n");
445442
}
446443

447444
rphy->edev = edev;
@@ -1417,10 +1414,8 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
14171414
}
14181415

14191416
ret = rockchip_usb2phy_clk480m_register(rphy);
1420-
if (ret) {
1421-
dev_err(dev, "failed to register 480m output clock\n");
1422-
return ret;
1423-
}
1417+
if (ret)
1418+
return dev_err_probe(dev, ret, "failed to register 480m output clock\n");
14241419

14251420
if (rphy->phy_cfg->phy_tuning) {
14261421
ret = rphy->phy_cfg->phy_tuning(rphy);
@@ -1440,8 +1435,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
14401435

14411436
phy = devm_phy_create(dev, child_np, &rockchip_usb2phy_ops);
14421437
if (IS_ERR(phy)) {
1443-
dev_err_probe(dev, PTR_ERR(phy), "failed to create phy\n");
1444-
ret = PTR_ERR(phy);
1438+
ret = dev_err_probe(dev, PTR_ERR(phy), "failed to create phy\n");
14451439
goto put_child;
14461440
}
14471441

@@ -1478,8 +1472,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
14781472
"rockchip_usb2phy",
14791473
rphy);
14801474
if (ret) {
1481-
dev_err(rphy->dev,
1482-
"failed to request usb2phy irq handle\n");
1475+
dev_err_probe(rphy->dev, ret, "failed to request usb2phy irq handle\n");
14831476
goto put_child;
14841477
}
14851478
}

0 commit comments

Comments
 (0)