public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: industrypack-devel@lists.sourceforge.net,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jens Taprogge <jens.taprogge@taprogge.org>,
	Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] ipack: Improve a size determination in ipack_bus_register()
Date: Sat, 13 May 2017 08:56:10 +0000	[thread overview]
Message-ID: <4c250243-7441-3c07-764d-1a23f950def7@users.sourceforge.net> (raw)
In-Reply-To: <b3fea957-b1bf-f681-8f70-d9d85106651b@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 13 May 2017 10:37:06 +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/ipack/ipack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index 575c4f29e0f7..a1e07a77d4e6 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -212,7 +212,7 @@ struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
 	int bus_nr;
 	struct ipack_bus_device *bus;
 
-	bus = kzalloc(sizeof(struct ipack_bus_device), GFP_KERNEL);
+	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
 	if (!bus)
 		return NULL;
 
-- 
2.12.3


  parent reply	other threads:[~2017-05-13  8:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13  8:54 [PATCH 0/2] Industry-pack bus: Adjustments for two function implementations SF Markus Elfring
2017-05-13  8:55 ` [PATCH 1/2] ipack: Delete an error message for a failed memory allocation in ipack_device_read_id() SF Markus Elfring
2017-05-15  9:08   ` Samuel Iglesias Gonsálvez
2017-05-15  9:08     ` [PATCH 2/2] ipack: Improve a size determination in ipack_bus_register() Samuel Iglesias Gonsálvez
2017-05-13  8:56 ` SF Markus Elfring [this message]
2017-05-15  4:52   ` Samuel Iglesias Gonsálvez
2017-05-15  5:56     ` Greg Kroah-Hartman
2017-05-15  6:40       ` 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=4c250243-7441-3c07-764d-1a23f950def7@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=industrypack-devel@lists.sourceforge.net \
    --cc=jens.taprogge@taprogge.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=siglesias@igalia.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