* [PATCH] platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()
@ 2026-08-15 9:34 Thorsten Blum
2026-08-17 15:54 ` Mark Pearson
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-08-15 9:34 UTC (permalink / raw)
To: Mark Pearson, Derek J. Clark, Hans de Goede, Ilpo Järvinen
Cc: Thorsten Blum, platform-driver-x86, linux-kernel
Use the ARRAY_SIZE() helper to simplify tlmi_errstr_to_err().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/platform/x86/lenovo/think-lmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c
index 26ee6ab34a15..81ab6aafee47 100644
--- a/drivers/platform/x86/lenovo/think-lmi.c
+++ b/drivers/platform/x86/lenovo/think-lmi.c
@@ -249,7 +249,7 @@ static int tlmi_errstr_to_err(const char *errstr)
{
int i;
- for (i = 0; i < sizeof(tlmi_errs)/sizeof(struct tlmi_err_codes); i++) {
+ for (i = 0; i < ARRAY_SIZE(tlmi_errs); i++) {
if (!strcmp(tlmi_errs[i].err_str, errstr))
return tlmi_errs[i].err_code;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()
2026-08-15 9:34 [PATCH] platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err() Thorsten Blum
@ 2026-08-17 15:54 ` Mark Pearson
0 siblings, 0 replies; 2+ messages in thread
From: Mark Pearson @ 2026-08-17 15:54 UTC (permalink / raw)
To: Thorsten Blum, Derek J . Clark, Hans de Goede, Ilpo Järvinen
Cc: platform-driver-x86@vger.kernel.org, linux-kernel
On Sat, Aug 15, 2026, at 5:34 AM, Thorsten Blum wrote:
> Use the ARRAY_SIZE() helper to simplify tlmi_errstr_to_err().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/platform/x86/lenovo/think-lmi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/lenovo/think-lmi.c
> b/drivers/platform/x86/lenovo/think-lmi.c
> index 26ee6ab34a15..81ab6aafee47 100644
> --- a/drivers/platform/x86/lenovo/think-lmi.c
> +++ b/drivers/platform/x86/lenovo/think-lmi.c
> @@ -249,7 +249,7 @@ static int tlmi_errstr_to_err(const char *errstr)
> {
> int i;
>
> - for (i = 0; i < sizeof(tlmi_errs)/sizeof(struct tlmi_err_codes); i++) {
> + for (i = 0; i < ARRAY_SIZE(tlmi_errs); i++) {
> if (!strcmp(tlmi_errs[i].err_str, errstr))
> return tlmi_errs[i].err_code;
> }
Thanks - looks good to me
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-17 15:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-15 9:34 [PATCH] platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err() Thorsten Blum
2026-08-17 15:54 ` Mark Pearson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox