* [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() @ 2026-09-07 9:01 Thorsten Blum 2026-09-09 15:26 ` Mark Pearson 2026-10-05 17:44 ` Ilpo Järvinen 0 siblings, 2 replies; 5+ messages in thread From: Thorsten Blum @ 2026-09-07 9:01 UTC (permalink / raw) To: Henrique de Moraes Holschuh, Mark Pearson, Derek J. Clark, Hans de Goede, Ilpo Järvinen Cc: Thorsten Blum, ibm-acpi-devel, platform-driver-x86, linux-kernel 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; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() 2026-09-07 9:01 [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() Thorsten Blum @ 2026-09-09 15:26 ` Mark Pearson 2026-09-09 16:49 ` Thorsten Blum 2026-10-05 17:44 ` Ilpo Järvinen 1 sibling, 1 reply; 5+ messages in thread From: Mark Pearson @ 2026-09-09 15:26 UTC (permalink / raw) To: Thorsten Blum, Henrique de Moraes Holschuh, Derek J . Clark, Hans de Goede, Ilpo Järvinen Cc: ibm-acpi-devel, platform-driver-x86@vger.kernel.org, linux-kernel 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? Mark ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() 2026-09-09 15:26 ` Mark Pearson @ 2026-09-09 16:49 ` Thorsten Blum 2026-09-10 0:58 ` Mark Pearson 0 siblings, 1 reply; 5+ messages in thread From: Thorsten Blum @ 2026-09-09 16:49 UTC (permalink / raw) To: Mark Pearson Cc: Henrique de Moraes Holschuh, Derek J . Clark, Hans de Goede, Ilpo Järvinen, ibm-acpi-devel, platform-driver-x86@vger.kernel.org, linux-kernel 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() 2026-09-09 16:49 ` Thorsten Blum @ 2026-09-10 0:58 ` Mark Pearson 0 siblings, 0 replies; 5+ messages in thread From: Mark Pearson @ 2026-09-10 0:58 UTC (permalink / raw) To: Thorsten Blum Cc: Henrique de Moraes Holschuh, Derek J . Clark, Hans de Goede, Ilpo Järvinen, ibm-acpi-devel, platform-driver-x86@vger.kernel.org, linux-kernel On Wed, Sep 9, 2026, at 12:49 PM, Thorsten Blum wrote: > 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. > Oh - good point, I had missed that. With that noted: Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Thanks Mark ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() 2026-09-07 9:01 [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() Thorsten Blum 2026-09-09 15:26 ` Mark Pearson @ 2026-10-05 17:44 ` Ilpo Järvinen 1 sibling, 0 replies; 5+ messages in thread From: Ilpo Järvinen @ 2026-10-05 17:44 UTC (permalink / raw) To: Henrique de Moraes Holschuh, Mark Pearson, Derek J. Clark, Hans de Goede, Thorsten Blum Cc: ibm-acpi-devel, platform-driver-x86, linux-kernel On Mon, 07 Sep 2026 11:01:05 +0200, 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(). Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while. FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix. The list of commits applied: [1/1] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() commit: c48091a8ac16b0fd1e7ffed29f11c4e6ea1acbb4 -- i. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-05 17:44 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-09-07 9:01 [PATCH] platform/x86: thinkpad_acpi: Remove unreachable code in beep_read() Thorsten Blum 2026-09-09 15:26 ` Mark Pearson 2026-09-09 16:49 ` Thorsten Blum 2026-09-10 0:58 ` Mark Pearson 2026-10-05 17:44 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox