linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] char/bsr: Improve a size determination in bsr_add_node()
Date: Sun, 15 Oct 2017 22:09:39 +0200	[thread overview]
Message-ID: <504858bd-8add-3820-541e-a3f0aa64df65@users.sourceforge.net> (raw)
In-Reply-To: <ff23c201-8043-124e-88fd-25e5abd382fb@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 15 Oct 2017 21:25:46 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/char/bsr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 865eb457e539..d0597dfa4d88 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -197,8 +197,7 @@ static int bsr_add_node(struct device_node *bn)
 	num_bsr_devs = bsr_bytes_len / sizeof(u32);
 
 	for (i = 0 ; i < num_bsr_devs; i++) {
-		struct bsr_dev *cur = kzalloc(sizeof(struct bsr_dev),
-					      GFP_KERNEL);
+		struct bsr_dev *cur = kzalloc(sizeof(*cur), GFP_KERNEL);
 		struct resource res;
 		int result;
 
-- 
2.14.2

  parent reply	other threads:[~2017-10-15 20:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-15 20:07 [PATCH 0/3] char-bsr: Adjustments for two function implementations SF Markus Elfring
2017-10-15 20:08 ` [PATCH 1/3] char/bsr: Delete an error message for a failed memory allocation in bsr_add_node() SF Markus Elfring
2017-10-15 20:09 ` SF Markus Elfring [this message]
2017-10-15 20:10 ` [PATCH 3/3] char/bsr: Adjust one function call together with a variable assignment SF Markus Elfring

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=504858bd-8add-3820-541e-a3f0aa64df65@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).