All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc().
@ 2016-02-22 10:36 Sandhya Bankar
  2016-02-23 19:39 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 6+ messages in thread
From: Sandhya Bankar @ 2016-02-22 10:36 UTC (permalink / raw)
  To: outreachy-kernel

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

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
 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 a91c60a..ea6b7b5 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 == NULL)
 		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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-23 20:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 10:36 [PATCH] Staging: slicoss: Use sizeof structure *pointer over sizeof structure in kmalloc()/kzalloc() Sandhya Bankar
2016-02-23 19:39 ` [Outreachy kernel] " Julia Lawall
2016-02-23 19:46   ` sandhya bankar
2016-02-23 19:56     ` Julia Lawall
2016-02-23 19:59       ` sandhya bankar
2016-02-23 20:46         ` sandhya bankar

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.