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

"Mark Pearson" <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
> ---
>  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 <[email protected]>
Mark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.