Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read()

From: Thorsten Blum

Date: Wed Sep 09 2026 - 13:25:39 EST


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@xxxxxxxxxx>
> > ---
> > 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