public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Pavel Machek <pavel@kernel.org>,
	Vicentiu Galanopulo <vicentiu.galanopulo@remote-tech.co.uk>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-leds@vger.kernel.org
Subject: Re: [PATCH] leds: st1202: Fix an error handling path in st1202_probe()
Date: Thu, 27 Feb 2025 17:50:33 +0000	[thread overview]
Message-ID: <20250227175033.GJ824852@google.com> (raw)
In-Reply-To: <307b6cbe-6079-4995-b395-b63de69edb4b@wanadoo.fr>

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@wanadoo.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 [李琼斯]

      reply	other threads:[~2025-02-27 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19 17:20 [PATCH] leds: st1202: Fix an error handling path in st1202_probe() Christophe JAILLET
2025-02-20 15:58 ` Lee Jones
2025-02-23 16:20   ` Christophe JAILLET
2025-02-27 17:50     ` Lee Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250227175033.GJ824852@google.com \
    --to=lee@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=vicentiu.galanopulo@remote-tech.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox