Re: [PATCH v1 1/3] platform/x86: huawei-wmi: do not hard-code sizes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 10/5/22 17:00, Barnabás Pőcze wrote:
> Use `sizeof()` and `ARRAY_SIZE()` instead of
> hard-coding buffer sizes and indices.
> 
> Signed-off-by: Barnabás Pőcze <pobrn@xxxxxxxxxxxxxx>

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/huawei-wmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
> index eac3e6b4ea11..66b53b90188f 100644
> --- a/drivers/platform/x86/huawei-wmi.c
> +++ b/drivers/platform/x86/huawei-wmi.c
> @@ -323,12 +323,12 @@ static int huawei_wmi_battery_get(int *start, int *end)
>  	u8 ret[0x100];
>  	int err, i;
> 
> -	err = huawei_wmi_cmd(BATTERY_THRESH_GET, ret, 0x100);
> +	err = huawei_wmi_cmd(BATTERY_THRESH_GET, ret, sizeof(ret));
>  	if (err)
>  		return err;
> 
>  	/* Find the last two non-zero values. Return status is ignored. */
> -	i = 0xff;
> +	i = ARRAY_SIZE(ret) - 1;
>  	do {
>  		if (start)
>  			*start = ret[i-1];
> --
> 2.38.0
> 
> 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux