[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y1vZXUi0Bjiub8HZ@ubunlion>
Date: Fri, 28 Oct 2022 19:00:05 +0530
From: Deepak R Varma <drv@...lo.com>
To: outreachy@...ts.linux.dev,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count
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__ }))
#define write_reg(par, ...) \
((par)->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__))
--
2.34.1
Powered by blists - more mailing lists