Message ID | 20160626072838.28082-20-stephen.boyd@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Jun 26, 2016 at 12:28:36AM -0700, Stephen Boyd wrote: > If something fails in ci_hdrc_add_device() due to probe defer, we > shouldn't print an error message. Be silent in this case as we'll > try probe again later. > > Cc: Peter Chen <peter.chen@nxp.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> > --- > drivers/usb/chipidea/ci_hdrc_msm.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c > index 7d191928e55b..2ed9a181f4b6 100644 > --- a/drivers/usb/chipidea/ci_hdrc_msm.c > +++ b/drivers/usb/chipidea/ci_hdrc_msm.c > @@ -241,7 +241,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) > plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, > pdev->num_resources, &ci->pdata); > if (IS_ERR(plat_ci)) { > - dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); > + if (PTR_ERR(plat_ci) != -EPROBE_DEFER) > + dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); > ret = PTR_ERR(plat_ci); > goto err_mux; > } Why not let ret equals to PTR_ERR(plat_ci) first, and using ret to compare?
Quoting Peter Chen (2016-06-29 18:06:28) > On Sun, Jun 26, 2016 at 12:28:36AM -0700, Stephen Boyd wrote: > > --- > > drivers/usb/chipidea/ci_hdrc_msm.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c > > index 7d191928e55b..2ed9a181f4b6 100644 > > --- a/drivers/usb/chipidea/ci_hdrc_msm.c > > +++ b/drivers/usb/chipidea/ci_hdrc_msm.c > > @@ -241,7 +241,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) > > plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, > > pdev->num_resources, &ci->pdata); > > if (IS_ERR(plat_ci)) { > > - dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); > > + if (PTR_ERR(plat_ci) != -EPROBE_DEFER) > > + dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); > > ret = PTR_ERR(plat_ci); > > goto err_mux; > > } > > Why not let ret equals to PTR_ERR(plat_ci) first, and using ret to > compare? Sure. I've fixed it up.
diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 7d191928e55b..2ed9a181f4b6 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -241,7 +241,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, &ci->pdata); if (IS_ERR(plat_ci)) { - dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); + if (PTR_ERR(plat_ci) != -EPROBE_DEFER) + dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); ret = PTR_ERR(plat_ci); goto err_mux; }
If something fails in ci_hdrc_add_device() due to probe defer, we shouldn't print an error message. Be silent in this case as we'll try probe again later. Cc: Peter Chen <peter.chen@nxp.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org> --- drivers/usb/chipidea/ci_hdrc_msm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)