diff mbox series

pwm: ab8500: Add error message if pwmchip_add() fails

Message ID 20200812075214.499-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series pwm: ab8500: Add error message if pwmchip_add() fails | expand

Commit Message

Uwe Kleine-König Aug. 12, 2020, 7:52 a.m. UTC
pwmchip_add() doesn't emit an error message, so add one in the driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-ab8500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lee Jones Aug. 12, 2020, 8:11 a.m. UTC | #1
On Wed, 12 Aug 2020, Uwe Kleine-König wrote:

> pwmchip_add() doesn't emit an error message, so add one in the driver.

Maybe placing one there would be a good idea.

It would certainly cut down on a lot of superfluous strings.

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-ab8500.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c
> index fdf3964db4a6..4b6f9e24e11d 100644
> --- a/drivers/pwm/pwm-ab8500.c
> +++ b/drivers/pwm/pwm-ab8500.c
> @@ -106,7 +106,7 @@ static int ab8500_pwm_probe(struct platform_device *pdev)
>  
>  	err = pwmchip_add(&ab8500->chip);
>  	if (err < 0)
> -		return err;
> +		return dev_err_probe(&pdev->dev, err, "Failed to add pwm chip\n");
>  
>  	dev_dbg(&pdev->dev, "pwm probe successful\n");
>  	platform_set_drvdata(pdev, ab8500);
Uwe Kleine-König Oct. 22, 2020, 7:22 p.m. UTC | #2
On Wed, Aug 12, 2020 at 09:11:39AM +0100, Lee Jones wrote:
> On Wed, 12 Aug 2020, Uwe Kleine-König wrote:
> 
> > pwmchip_add() doesn't emit an error message, so add one in the driver.
> 
> Maybe placing one there would be a good idea.
> 
> It would certainly cut down on a lot of superfluous strings.

Hmm, I'm not convinced. Do you want to work on that? If not I suggest to
still apply the patch as currently it is justified.

Best regards
Uwe
Lee Jones Oct. 26, 2020, 9:33 a.m. UTC | #3
On Thu, 22 Oct 2020, Uwe Kleine-König wrote:

> On Wed, Aug 12, 2020 at 09:11:39AM +0100, Lee Jones wrote:
> > On Wed, 12 Aug 2020, Uwe Kleine-König wrote:
> > 
> > > pwmchip_add() doesn't emit an error message, so add one in the driver.
> > 
> > Maybe placing one there would be a good idea.
> > 
> > It would certainly cut down on a lot of superfluous strings.
> 
> Hmm, I'm not convinced. Do you want to work on that? If not I suggest to
> still apply the patch as currently it is justified.

I haven't looked at implementing it.  Does it look difficult/
Uwe Kleine-König Nov. 3, 2020, 8 a.m. UTC | #4
On Mon, Oct 26, 2020 at 09:33:00AM +0000, Lee Jones wrote:
> On Thu, 22 Oct 2020, Uwe Kleine-König wrote:
> 
> > On Wed, Aug 12, 2020 at 09:11:39AM +0100, Lee Jones wrote:
> > > On Wed, 12 Aug 2020, Uwe Kleine-König wrote:
> > > 
> > > > pwmchip_add() doesn't emit an error message, so add one in the driver.
> > > 
> > > Maybe placing one there would be a good idea.
> > > 
> > > It would certainly cut down on a lot of superfluous strings.
> > 
> > Hmm, I'm not convinced. Do you want to work on that? If not I suggest to
> > still apply the patch as currently it is justified.
> 
> I haven't looked at implementing it.  Does it look difficult/

Probably it isn't, needs just some endurance to actually do it. (And I
won't invest that in the near future, also because I'm not convinced
that the result is beneficial.)

Best regards
Uwe
Lee Jones Nov. 3, 2020, 8:18 a.m. UTC | #5
On Tue, 03 Nov 2020, Uwe Kleine-König wrote:

> On Mon, Oct 26, 2020 at 09:33:00AM +0000, Lee Jones wrote:
> > On Thu, 22 Oct 2020, Uwe Kleine-König wrote:
> > 
> > > On Wed, Aug 12, 2020 at 09:11:39AM +0100, Lee Jones wrote:
> > > > On Wed, 12 Aug 2020, Uwe Kleine-König wrote:
> > > > 
> > > > > pwmchip_add() doesn't emit an error message, so add one in the driver.
> > > > 
> > > > Maybe placing one there would be a good idea.
> > > > 
> > > > It would certainly cut down on a lot of superfluous strings.
> > > 
> > > Hmm, I'm not convinced. Do you want to work on that? If not I suggest to
> > > still apply the patch as currently it is justified.
> > 
> > I haven't looked at implementing it.  Does it look difficult/
> 
> Probably it isn't, needs just some endurance to actually do it. (And I
> won't invest that in the near future, also because I'm not convinced
> that the result is beneficial.)

I'll add it to my TODO list.

In the mean time, don't let this halt the patch.
Linus Walleij Nov. 6, 2020, 1:55 p.m. UTC | #6
On Wed, Aug 12, 2020 at 9:52 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

> pwmchip_add() doesn't emit an error message, so add one in the driver.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Thierry Reding Nov. 11, 2020, 6:07 p.m. UTC | #7
On Wed, Aug 12, 2020 at 09:52:14AM +0200, Uwe Kleine-König wrote:
> pwmchip_add() doesn't emit an error message, so add one in the driver.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-ab8500.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-ab8500.c b/drivers/pwm/pwm-ab8500.c
index fdf3964db4a6..4b6f9e24e11d 100644
--- a/drivers/pwm/pwm-ab8500.c
+++ b/drivers/pwm/pwm-ab8500.c
@@ -106,7 +106,7 @@  static int ab8500_pwm_probe(struct platform_device *pdev)
 
 	err = pwmchip_add(&ab8500->chip);
 	if (err < 0)
-		return err;
+		return dev_err_probe(&pdev->dev, err, "Failed to add pwm chip\n");
 
 	dev_dbg(&pdev->dev, "pwm probe successful\n");
 	platform_set_drvdata(pdev, ab8500);