From: Marwin Hormiz <marwinhormiz@gmail.com>
To: dpenkler@gmail.com, gregkh@linuxfoundation.org
Cc: dan.carpenter@linaro.org, matchstick@neverthere.org,
arnd@arndb.de, niharchaithanya@gmail.com,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Marwin Hormiz <marwinhormiz@gmail.com>
Subject: [PATCH 1/1] staging: gpib: gpio: Fix memory allocation style in gpib_bitbang.c
Date: Mon, 21 Apr 2025 20:41:44 +0200 [thread overview]
Message-ID: <20250421184144.220972-1-marwinhormiz@gmail.com> (raw)
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
next reply other threads:[~2025-04-21 18:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 18:41 Marwin Hormiz [this message]
2025-04-22 2:09 ` [PATCH 1/1] staging: gpib: gpio: Fix memory allocation style in gpib_bitbang.c kernel test robot
2025-04-22 6:19 ` Arnd Bergmann
2025-04-22 6:33 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250421184144.220972-1-marwinhormiz@gmail.com \
--to=marwinhormiz@gmail.com \
--cc=arnd@arndb.de \
--cc=dan.carpenter@linaro.org \
--cc=dpenkler@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=matchstick@neverthere.org \
--cc=niharchaithanya@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox