public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-rdma@vger.kernel.org, Doug Ledford <dledford@redhat.com>,
	Faisal Latif <faisal.latif@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	Sean Hefty <sean.hefty@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 5/5] IB/nes: Improve size determinations in two functions
Date: Mon, 06 Mar 2017 17:44:56 +0000	[thread overview]
Message-ID: <540c6942-94c8-4042-0bd0-62dc9140a0c6@users.sourceforge.net> (raw)
In-Reply-To: <502a5a6f-ee91-dd2f-cdc7-63f396059529@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 6 Mar 2017 18:12:37 +0100

Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determinations a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/nes/nes_verbs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 7764ba423c1c..5cbb62e44d84 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -678,7 +678,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev,
 	if (err)
 		return ERR_PTR(err);
 
-	nespd = kzalloc(sizeof (struct nes_pd), GFP_KERNEL);
+	nespd = kzalloc(sizeof(*nespd), GFP_KERNEL);
 	if (!nespd) {
 		nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
 		return ERR_PTR(-ENOMEM);
@@ -1447,7 +1447,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
 	if (err)
 		return ERR_PTR(err);
 
-	nescq = kzalloc(sizeof(struct nes_cq), GFP_KERNEL);
+	nescq = kzalloc(sizeof(*nescq), GFP_KERNEL);
 	if (!nescq) {
 		nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
 		return ERR_PTR(-ENOMEM);
-- 
2.12.0


      parent reply	other threads:[~2017-03-06 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 17:38 [PATCH 0/5] IB/nes: Fine-tuning for some function implementations SF Markus Elfring
2017-03-06 17:40 ` [PATCH 1/5] IB/nes: Use kcalloc() in nes_init_mgt_qp() SF Markus Elfring
2017-03-06 17:41 ` [PATCH 2/5] IB/nes: Use kcalloc() in nes_reg_user_mr() SF Markus Elfring
2017-03-06 17:42 ` [PATCH 3/5] IB/nes: Adjust 16 checks for null pointers SF Markus Elfring
2017-03-06 17:43 ` [PATCH 4/5] IB/nes: Delete unnecessary braces SF Markus Elfring
2017-03-06 18:37   ` Joe Perches
2017-03-06 20:56   ` Julia Lawall
2017-03-06 17:44 ` SF Markus Elfring [this message]

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=540c6942-94c8-4042-0bd0-62dc9140a0c6@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.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