platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()
Subsystems (3)
PATCH 1/1 platform/x86: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()
Use the ARRAY_SIZE() helper to simplify tlmi_errstr_to_err().
--- drivers/platform/x86/lenovo/think-lmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/lenovo/think-lmi.c +1 -1
@@ -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; }
Quoted 13 lines · Thorsten Blum
Use the
ARRAY_SIZE()helper to simplifytlmi_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(-)drivers/platform/x86/lenovo/think-lmi.c +0
-0
drivers/platform/x86/lenovo/think-lmi.c static int tlmi_errstr_to_err(const char *errstr) · line 255
Quoted 8 lines
drivers/platform/x86/lenovo/think-lmi.c +1
-1@@ -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
Mark
Ilpo Järvinen
maintainerQuoted 1 line · Thorsten Blum
Use the
ARRAY_SIZE()helper to simplifytlmi_errstr_to_err().
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: think-lmi: Use ARRAY_SIZE() in tlmi_errstr_to_err()
commit: 2ba3e60e4e073b48abde8e787fe6fffaacdc4007
--
i.