[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250227175033.GJ824852@google.com>
Date: Thu, 27 Feb 2025 17:50:33 +0000
From: Lee Jones <lee@...nel.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Pavel Machek <pavel@...nel.org>,
Vicentiu Galanopulo <vicentiu.galanopulo@...ote-tech.co.uk>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
linux-leds@...r.kernel.org
Subject: Re: [PATCH] leds: st1202: Fix an error handling path in
st1202_probe()
On Sun, 23 Feb 2025, Christophe JAILLET wrote:
> Le 20/02/2025 à 16:58, Lee Jones a écrit :
> > On Wed, 19 Feb 2025, Christophe JAILLET wrote:
> >
> > > devm_mutex_init() may return -ENOMEM.
> > > So this error should be handled in st1202_probe().
> >
> > The start of a new sentence shouldn't warrant a line break.
> >
> > > Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> > > ---
> > > drivers/leds/leds-st1202.c | 5 ++++-
> > > 1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
> > > index b691c4886993..4fc17d518292 100644
> > > --- a/drivers/leds/leds-st1202.c
> > > +++ b/drivers/leds/leds-st1202.c
> > > @@ -356,7 +356,10 @@ static int st1202_probe(struct i2c_client *client)
> > > if (!chip)
> > > return -ENOMEM;
> > > - devm_mutex_init(&client->dev, &chip->lock);
> > > + ret = devm_mutex_init(&client->dev, &chip->lock);
> > > + if (ret < 0)
> >
> > My assumption is that anything but 0 would be bad, thus:
> >
> > if (ret)
>
> Matter of taste. All other tests in this driver are "if (ret < 0)" or "if
> (ret != 0)".
>
> What do you prefer: consistency or concision? (my own choice goes to
> consistency)
>
> If you confirm concision, I'll send a v2 that also fix your other comment
> above.
Ah, I just attempted to apply the patch, but it looks like it's already
fixed in ("leds: st1202: Check for error code from devm_mutex_init()
call").
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists