public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: gpib: gpio: Fix memory allocation style in gpib_bitbang.c
@ 2025-04-21 18:41 Marwin Hormiz
  2025-04-22  2:09 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marwin Hormiz @ 2025-04-21 18:41 UTC (permalink / raw)
  To: dpenkler, gregkh
  Cc: dan.carpenter, matchstick, arnd, niharchaithanya, linux-staging,
	linux-kernel, Marwin Hormiz

Change kzalloc() to use sizeof(*variable) instead of sizeof(struct type)
to improve code maintainability. This follows the kernel coding style
recommendation for memory allocations.

Signed-off-by: Marwin Hormiz <marwinhormiz@gmail.com>
---
 drivers/staging/gpib/gpio/gpib_bitbang.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 86bdd381472a..28f2f44deb39 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -46,10 +46,10 @@
 			dev_dbg(board->gpib_dev, frm, ## __VA_ARGS__); } \
 	while (0)
 
-#define LINVAL gpiod_get_value(DAV),		\
+#define LINVAL (gpiod_get_value(DAV),		\
 		gpiod_get_value(NRFD),		\
 		gpiod_get_value(NDAC),		\
-		gpiod_get_value(SRQ)
+		gpiod_get_value(SRQ))
 #define LINFMT "DAV: %d	 NRFD:%d  NDAC: %d SRQ: %d"
 
 #include "gpibP.h"
@@ -1063,7 +1063,7 @@ static int bb_line_status(const struct gpib_board *board)
 
 static int allocate_private(struct gpib_board *board)
 {
-	board->private_data = kzalloc(sizeof(struct bb_priv), GFP_KERNEL);
+	board->private_data = kzalloc(sizeof(*board->private_data), GFP_KERNEL);
 	if (!board->private_data)
 		return -1;
 	return 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-22  6:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-21 18:41 [PATCH 1/1] staging: gpib: gpio: Fix memory allocation style in gpib_bitbang.c Marwin Hormiz
2025-04-22  2:09 ` kernel test robot
2025-04-22  6:19 ` Arnd Bergmann
2025-04-22  6:33 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox