Re: [PATCH 2/2] bus: ts-nbus: Improve error reporting

From: Uwe Kleine-König
Date: Sun Dec 10 2023 - 09:13:52 EST


Hello,

[dropped Sebastien from Cc, the address doesn't work]

On Sun, Dec 10, 2023 at 07:55:02AM +0100, Christophe JAILLET wrote:
> Le 09/12/2023 à 23:35, Uwe Kleine-König a écrit :
> > Using dev_err_probe() brings several improvements:
> >
> > - emits the symbolic error code
> > - properly handles EPROBE_DEFER
> > - combines error message generation and return value handling
> >
> > While at it add error messages to two error paths that were silent
> > before.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> > ---
> > drivers/bus/ts-nbus.c | 65 ++++++++++++++++++-------------------------
> > 1 file changed, 27 insertions(+), 38 deletions(-)
> >
> > diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c
>
> ...
>
> > @@ -289,25 +283,19 @@ static int ts_nbus_probe(struct platform_device *pdev)
> > return ret;
> > pwm = devm_pwm_get(dev, NULL);
> > - if (IS_ERR(pwm)) {
> > - ret = PTR_ERR(pwm);
> > - if (ret != -EPROBE_DEFER)
> > - dev_err(dev, "unable to request PWM\n");
> > - return ret;
> > - }
> > + if (IS_ERR(pwm))
> > + return dev_err_probe(dev, ret, "unable to request PWM\n");
>
> s/ret/PTR_ERR(pwm)/

Indeed. Thanks for spotting that. Will send a v2 after waiting a bit
more for feedback.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature