All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sandhya Bankar <bankarsandhya512@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH v2] Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().
Date: Tue, 8 Mar 2016 16:05:37 +0530	[thread overview]
Message-ID: <20160308103537.GA3305@sandhya> (raw)

Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
Changes in v2:
* No change.
*Compile this patch to check nothing is broken.

 drivers/staging/slicoss/slicoss.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index acf73f0..ed1c067 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -880,7 +880,7 @@ static int slic_upr_queue_request(struct adapter *adapter,
 	struct slic_upr *upr;
 	struct slic_upr *uprqueue;
 
-	upr = kmalloc(sizeof(struct slic_upr), GFP_ATOMIC);
+	upr = kmalloc(sizeof(*upr), GFP_ATOMIC);
 	if (!upr)
 		return -ENOMEM;
 
@@ -1806,7 +1806,7 @@ static int slic_mcast_add_list(struct adapter *adapter, char *address)
 	}
 
 	/* Doesn't already exist.  Allocate a structure to hold it */
-	mcaddr = kmalloc(sizeof(struct mcast_address), GFP_ATOMIC);
+	mcaddr = kmalloc(sizeof(*mcaddr), GFP_ATOMIC);
 	if (!mcaddr)
 		return 1;
 
@@ -3049,7 +3049,7 @@ static u32 slic_card_locate(struct adapter *adapter)
 	}
 	if (!physcard) {
 		/* no structure allocated for this physical card yet */
-		physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC);
+		physcard = kzalloc(sizeof(*physcard), GFP_ATOMIC);
 		if (!physcard) {
 			if (card_hostid == SLIC_HOSTID_DEFAULT)
 				kfree(card);
-- 
1.8.3.4



             reply	other threads:[~2016-03-08 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 10:35 Sandhya Bankar [this message]
2016-03-11 18:08 ` [Outreachy kernel] [PATCH v2] Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/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=20160308103537.GA3305@sandhya \
    --to=bankarsandhya512@gmail.com \
    --cc=outreachy-kernel@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.