Re: [PATCH] platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()

From: Mark Pearson

Date: Mon Aug 17 2026 - 13:21:46 EST


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@xxxxxxxxx>
> ---
> 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@xxxxxxxxx>
Mark