Commit d6fef932 authored by Barnabás Pőcze's avatar Barnabás Pőcze Committed by Hans de Goede

platform/x86: huawei-wmi: do not hard-code sizes

Use `sizeof()` and `ARRAY_SIZE()` instead of
hard-coding buffer sizes and indices.
Signed-off-by: default avatarBarnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20221005150032.173198-1-pobrn@protonmail.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent a77272c1
...@@ -323,12 +323,12 @@ static int huawei_wmi_battery_get(int *start, int *end) ...@@ -323,12 +323,12 @@ static int huawei_wmi_battery_get(int *start, int *end)
u8 ret[0x100]; u8 ret[0x100];
int err, i; int err, i;
err = huawei_wmi_cmd(BATTERY_THRESH_GET, ret, 0x100); err = huawei_wmi_cmd(BATTERY_THRESH_GET, ret, sizeof(ret));
if (err) if (err)
return err; return err;
/* Find the last two non-zero values. Return status is ignored. */ /* Find the last two non-zero values. Return status is ignored. */
i = 0xff; i = ARRAY_SIZE(ret) - 1;
do { do {
if (start) if (start)
*start = ret[i-1]; *start = ret[i-1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment