Message ID | 20250410133332.294556-2-linux.amoon@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Messon: Simplify error handling with dev_err_probe() | expand |
On 10/04/2025 15:33, Anand Moon wrote: > Use dev_err_probe() for phy resources to indicate the deferral > reason when waiting for the resource to come up. > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > --- > drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c > index 14ea89927ab14..6b390304f723c 100644 > --- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c > +++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c > @@ -237,7 +237,6 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) > struct phy_meson_gxl_usb2_priv *priv; > struct phy *phy; > void __iomem *base; > - int ret; > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > @@ -266,13 +265,9 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) > return PTR_ERR(priv->reset); > > phy = devm_phy_create(dev, NULL, &phy_meson_gxl_usb2_ops); > - if (IS_ERR(phy)) { > - ret = PTR_ERR(phy); > - if (ret != -EPROBE_DEFER) > - dev_err(dev, "failed to create PHY\n"); > - > - return ret; > - } > + if (IS_ERR(phy)) > + return dev_err_probe(dev, PTR_ERR(phy), > + "failed to create PHY\n"); > > phy_set_drvdata(phy, priv); > Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c index 14ea89927ab14..6b390304f723c 100644 --- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c +++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c @@ -237,7 +237,6 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) struct phy_meson_gxl_usb2_priv *priv; struct phy *phy; void __iomem *base; - int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -266,13 +265,9 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev) return PTR_ERR(priv->reset); phy = devm_phy_create(dev, NULL, &phy_meson_gxl_usb2_ops); - if (IS_ERR(phy)) { - ret = PTR_ERR(phy); - if (ret != -EPROBE_DEFER) - dev_err(dev, "failed to create PHY\n"); - - return ret; - } + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), + "failed to create PHY\n"); phy_set_drvdata(phy, priv);
Use dev_err_probe() for phy resources to indicate the deferral reason when waiting for the resource to come up. Signed-off-by: Anand Moon <linux.amoon@gmail.com> --- drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)