public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ajanth Badiger <badigerajanth1301@gmail.com>
To: dpenkler@gmail.com, gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Ajanth Badiger <badigerajanth1301@gmail.com>
Subject: [PATCH] staging: gpib: gpio: use sizeof(*ptr) in kzalloc
Date: Sun,  3 May 2026 15:05:58 +0530	[thread overview]
Message-ID: <20260503093558.68105-1-badigerajanth1301@gmail.com> (raw)

Replace sizeof(struct bb_priv) with sizeof(*board->private_data)
to follow kernel coding style and improve maintainability.

checkpatch.pl also reports that LINVAL macro should be enclosed
in parentheses. However, LINVAL intentionally expands to a
comma-separated list of arguments matching the LINFMT format
string used in dbg_printk() calls.

Wrapping it in parentheses would change semantics due to the
comma operator, causing only the last expression to be passed.

Therefore, no change is made to LINVAL.

Signed-off-by: Ajanth Badiger <badigerajanth1301@gmail.com>
---
 drivers/staging/gpib/gpio/gpib_bitbang.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 374cd61355e9..2fff9ec9a01c 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -1066,7 +1066,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.43.0


             reply	other threads:[~2026-05-03  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03  9:35 Ajanth Badiger [this message]
2026-05-03  9:48 ` [PATCH] staging: gpib: gpio: use sizeof(*ptr) in kzalloc Greg KH

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=20260503093558.68105-1-badigerajanth1301@gmail.com \
    --to=badigerajanth1301@gmail.com \
    --cc=dpenkler@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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