Message ID | 20220614120522.1469957-1-alexander.stein@ew.tq-group.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 18171cfc3c236a1587dcad9adc27c6e781af4438 |
Headers | show |
Series | [1/1] usb: chipidea: ci_hdrc_imx: use dev_err_probe() | expand |
On 22-06-14 14:05:22, Alexander Stein wrote: > Use dev_err_probe() to simplify handling errors in ci_hdrc_imx_probe() > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Acked-by: Peter Chen <peter.chen@kernel.org> Peter > --- > drivers/usb/chipidea/ci_hdrc_imx.c | 23 +++++++---------------- > 1 file changed, 7 insertions(+), 16 deletions(-) > > diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c > index 097142ffb184..9ffcecd3058c 100644 > --- a/drivers/usb/chipidea/ci_hdrc_imx.c > +++ b/drivers/usb/chipidea/ci_hdrc_imx.c > @@ -348,25 +348,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) > data->pinctrl = devm_pinctrl_get(dev); > if (PTR_ERR(data->pinctrl) == -ENODEV) > data->pinctrl = NULL; > - else if (IS_ERR(data->pinctrl)) { > - if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER) > - dev_err(dev, "pinctrl get failed, err=%ld\n", > - PTR_ERR(data->pinctrl)); > - return PTR_ERR(data->pinctrl); > - } > + else if (IS_ERR(data->pinctrl)) > + return dev_err_probe(dev, PTR_ERR(data->pinctrl), > + "pinctrl get failed\n"); > > data->hsic_pad_regulator = > devm_regulator_get_optional(dev, "hsic"); > if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { > /* no pad regualator is needed */ > data->hsic_pad_regulator = NULL; > - } else if (IS_ERR(data->hsic_pad_regulator)) { > - if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) > - dev_err(dev, > - "Get HSIC pad regulator error: %ld\n", > - PTR_ERR(data->hsic_pad_regulator)); > - return PTR_ERR(data->hsic_pad_regulator); > - } > + } else if (IS_ERR(data->hsic_pad_regulator)) > + return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator), > + "Get HSIC pad regulator error\n"); > > if (data->hsic_pad_regulator) { > ret = regulator_enable(data->hsic_pad_regulator); > @@ -458,9 +451,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) > &pdata); > if (IS_ERR(data->ci_pdev)) { > ret = PTR_ERR(data->ci_pdev); > - if (ret != -EPROBE_DEFER) > - dev_err(dev, "ci_hdrc_add_device failed, err=%d\n", > - ret); > + dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n"); > goto err_clk; > } > > -- > 2.25.1 >
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 097142ffb184..9ffcecd3058c 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -348,25 +348,18 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) data->pinctrl = devm_pinctrl_get(dev); if (PTR_ERR(data->pinctrl) == -ENODEV) data->pinctrl = NULL; - else if (IS_ERR(data->pinctrl)) { - if (PTR_ERR(data->pinctrl) != -EPROBE_DEFER) - dev_err(dev, "pinctrl get failed, err=%ld\n", - PTR_ERR(data->pinctrl)); - return PTR_ERR(data->pinctrl); - } + else if (IS_ERR(data->pinctrl)) + return dev_err_probe(dev, PTR_ERR(data->pinctrl), + "pinctrl get failed\n"); data->hsic_pad_regulator = devm_regulator_get_optional(dev, "hsic"); if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { /* no pad regualator is needed */ data->hsic_pad_regulator = NULL; - } else if (IS_ERR(data->hsic_pad_regulator)) { - if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) - dev_err(dev, - "Get HSIC pad regulator error: %ld\n", - PTR_ERR(data->hsic_pad_regulator)); - return PTR_ERR(data->hsic_pad_regulator); - } + } else if (IS_ERR(data->hsic_pad_regulator)) + return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator), + "Get HSIC pad regulator error\n"); if (data->hsic_pad_regulator) { ret = regulator_enable(data->hsic_pad_regulator); @@ -458,9 +451,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) &pdata); if (IS_ERR(data->ci_pdev)) { ret = PTR_ERR(data->ci_pdev); - if (ret != -EPROBE_DEFER) - dev_err(dev, "ci_hdrc_add_device failed, err=%d\n", - ret); + dev_err_probe(dev, ret, "ci_hdrc_add_device failed\n"); goto err_clk; }
Use dev_err_probe() to simplify handling errors in ci_hdrc_imx_probe() Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- drivers/usb/chipidea/ci_hdrc_imx.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)