mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: "Matthew Garrett" <mjg59@srcf.ucam.org>,
	"Pali Rohár" <pali@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Gabriele Mazzotta" <gabriele.mzt@gmail.com>,
	"Darren Hart" <dvhart@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] platform/x86: dell-laptop: Parse the charge end threshold as an int
Date: Tue, 24 Nov 2026 16:20:00 +0200 (EET)	[thread overview]
Message-ID: <ce0f3108-ef9e-08a7-9b5c-b0a330159988@linux.intel.com> (raw)
In-Reply-To: <CAKxU2N8cn+hbUH4iwP2w6myQV28LM1+djvmQfN92A8z1G9Y5Tw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

On Mon, 23 Nov 2026, Rosen Penev wrote:

> On Mon, Nov 23, 2026 at 12:32 AM Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com> wrote:
> >
> > On Fri, 20 Nov 2026, Rosen Penev wrote:
> >
> > > charge_control_end_threshold_store() passes a pointer to an int to
> > > kstrtouint(), which only builds because the kernel disables
> > > -Wpointer-sign, and makes the following "end < 0" check dead code.
> > > Use kstrtoint() like charge_control_start_threshold_store(). Values
> > > outside 0 to 100 are rejected either way.
> >
> > Why the <0 check has to be kept on the driver side?
>
> It's currently a one line change instead of three.

Huh!?! What criteria is that?! :-/

...Could you then, like change those three lines instead. Please.

--
 i.

> >
> > Why not change the variable type instead and remove the then dead code
> > check?
> >
> > It's somewhat disappointing this even has to be pointed out by review.
> >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > >  drivers/platform/x86/dell/dell-laptop.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c
> > > index eca348497ac3..c512267be4c4 100644
> > > --- a/drivers/platform/x86/dell/dell-laptop.c
> > > +++ b/drivers/platform/x86/dell/dell-laptop.c
> > > @@ -2382,7 +2382,7 @@ static ssize_t charge_control_end_threshold_store(struct device *dev,
> > >  {
> > >       int ret, end;
> > >
> > > -     ret = kstrtouint(buf, 10, &end);
> > > +     ret = kstrtoint(buf, 10, &end);
> > >       if (ret)
> > >               return ret;
> > >       if (end < 0 || end > 100)
> > >
> >
> > --
> >  i.
> >
> 

      reply	other threads:[~2026-11-24 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  0:09 [PATCH v2 0/3] platform/x86: dell-laptop: Fix keyboard backlight and charge threshold handling Rosen Penev
2026-11-21  0:09 ` [PATCH v2 1/3] platform/x86: dell-laptop: Fix keyboard backlight timeout overflow Rosen Penev
2026-11-21  0:09 ` [PATCH v2 2/3] platform/x86: dell-laptop: Don't use an unread keyboard state at init Rosen Penev
2026-11-21  0:09 ` [PATCH v2 3/3] platform/x86: dell-laptop: Parse the charge end threshold as an int Rosen Penev
2026-11-23  8:32   ` Ilpo Järvinen
2026-11-24  0:21     ` Rosen Penev
2026-11-24 14:20       ` Ilpo Järvinen [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=ce0f3108-ef9e-08a7-9b5c-b0a330159988@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=dvhart@linux.intel.com \
    --cc=gabriele.mzt@gmail.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pali@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rosenp@gmail.com \
    /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

all inboxes | Powered by JetHome®