[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1zXIjCe3LGwApWD@kroah.com>
Date: Sat, 29 Oct 2022 09:32:50 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Deepak R Varma <drv@...lo.com>
Cc: outreachy@...ts.linux.dev, dri-devel@...ts.freedesktop.org,
linux-fbdev@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count
On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> number of elements in an array. Issue identified using coccicheck.
>
> Signed-off-by: Deepak R Varma <drv@...lo.com>
> ---
> drivers/staging/fbtft/fbtft.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> index 2c2b5f1c1df3..5506a473be91 100644
> --- a/drivers/staging/fbtft/fbtft.h
> +++ b/drivers/staging/fbtft/fbtft.h
> @@ -231,7 +231,7 @@ struct fbtft_par {
> bool polarity;
> };
>
> -#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> +#define NUMARGS(...) ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
Please please please test-build your patches before sending them out.
To not do so just wastes reviewer resources :(
thanks,
greg k-h
Powered by blists - more mailing lists