From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>,
Jens Axboe <axboe@kernel.dk>,
Johannes Thumshirn <jthumshirn@suse.de>,
Ming Lei <ming.lei@redhat.com>, Sagi Grimberg <sagi@grimberg.me>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/5] mtip32xx: Improve a size determination in two functions
Date: Sun, 6 Aug 2017 21:20:12 +0200 [thread overview]
Message-ID: <1c74be0c-6457-2f59-54b2-5e4fe1a70ace@users.sourceforge.net> (raw)
In-Reply-To: <524db5d1-1411-a839-6461-7c33403c1843@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 6 Aug 2017 19:54:49 +0200
Replace the specification of data structures by pointer dereferences
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/block/mtip32xx/mtip32xx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 5ccbab619e57..97cbf39b4273 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3019,9 +3019,7 @@ static int mtip_hw_init(struct driver_data *dd)
num_command_slots = dd->slot_groups * 32;
hba_setup(dd);
-
- dd->port = kzalloc_node(sizeof(struct mtip_port), GFP_KERNEL,
- dd->numa_node);
+ dd->port = kzalloc_node(sizeof(*dd->port), GFP_KERNEL, dd->numa_node);
if (!dd->port)
return -ENOMEM;
@@ -4215,7 +4213,7 @@ static int mtip_pci_probe(struct pci_dev *pdev,
my_node, pcibus_to_node(pdev->bus), dev_to_node(&pdev->dev),
cpu_to_node(raw_smp_processor_id()), raw_smp_processor_id());
- dd = kzalloc_node(sizeof(struct driver_data), GFP_KERNEL, my_node);
+ dd = kzalloc_node(sizeof(*dd), GFP_KERNEL, my_node);
if (!dd)
return -ENOMEM;
--
2.13.4
next prev parent reply other threads:[~2017-08-06 19:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-06 19:15 [PATCH 0/5] mtip32xx: Adjustments for some function implementations SF Markus Elfring
2017-08-06 19:17 ` [PATCH 1/5] mtip32xx: Delete an error message for a failed memory allocation in five functions SF Markus Elfring
2017-08-07 5:48 ` kbuild test robot
2017-08-06 19:20 ` SF Markus Elfring [this message]
2017-08-06 19:22 ` [PATCH 3/5] mtip32xx: Delete an unnecessary variable initialisation in mtip_pci_probe() SF Markus Elfring
2017-08-06 19:23 ` [PATCH 4/5] mtip32xx: Fix a typo in a comment line in mtip_hw_get_identify() SF Markus Elfring
2017-08-06 19:24 ` [PATCH 5/5] mtip32xx: Adjust an input validation check in mtip_hw_debugfs_exit() 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=1c74be0c-6457-2f59-54b2-5e4fe1a70ace@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=Bart.VanAssche@sandisk.com \
--cc=axboe@kernel.dk \
--cc=jthumshirn@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
/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
all inboxes | Powered by JetHome®