mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Mark Pearson <mpearson-lenovo@squebb.ca>
Cc: "Henrique de Moraes Holschuh" <hmh@hmh.eng.br>,
	"Derek J . Clark" <derekjohn.clark@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	ibm-acpi-devel@lists.sourceforge.net,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read()
Date: Wed, 9 Sep 2026 18:49:48 +0200	[thread overview]
Message-ID: <aqGOLBx_hU3a7ADQ@kernel.org> (raw)
In-Reply-To: <254d9c60-d21e-4ef5-b70e-89dd18ff7147@app.fastmail.com>

On Wed, Sep 09, 2026 at 11:26:18AM -0400, Mark Pearson wrote:
> Hi Thorsten,
> 
> On Mon, Sep 7, 2026, at 5:01 AM, Thorsten Blum wrote:
> > The procfs entry /proc/acpi/ibm/beep is only created if beep_init()
> > succeeds, which requires beep_handle to be non-NULL. Remove the
> > unreachable code branch from beep_read().
> >
> > Signed-off-by: Thorsten Blum <blum@kernel.org>
> > ---
> >  drivers/platform/x86/lenovo/thinkpad_acpi.c | 8 ++------
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c 
> > b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> > index 1082c36ae723..069c9f1c359f 100644
> > --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> > +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> > @@ -5936,12 +5936,8 @@ static int __init beep_init(struct 
> > ibm_init_struct *iibm)
> > 
> >  static int beep_read(struct seq_file *m)
> >  {
> > -	if (!beep_handle)
> > -		seq_puts(m, "status:\t\tnot supported\n");
> > -	else {
> > -		seq_puts(m, "status:\t\tsupported\n");
> > -		seq_puts(m, "commands:\t<cmd> (<cmd> is 0-17)\n");
> > -	}
> > +	seq_puts(m, "status:\t\tsupported\n");
> > +	seq_puts(m, "commands:\t<cmd> (<cmd> is 0-17)\n");
> > 
> >  	return 0;
> >  }
> 
> Change looks good to me.
> I guess the beep_write could be similarly updated?

No, beep_write() can be called via the beep= module parameter even if
beep_init() failed, so that check is still needed.

Thanks,
Thorsten

  reply	other threads:[~2026-09-09 16:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  9:01 Thorsten Blum
2026-09-09 15:26 ` Mark Pearson
2026-09-09 16:49   ` Thorsten Blum [this message]
2026-09-10  0:58     ` Mark Pearson

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=aqGOLBx_hU3a7ADQ@kernel.org \
    --to=blum@kernel.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    /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®