linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/3] Staging: sm7xx: preferred form for passing a size to memory allocation routines
@ 2011-05-19 15:28 anish
  0 siblings, 0 replies; 3+ messages in thread
From: anish @ 2011-05-19 15:28 UTC (permalink / raw)
  To: greg, teddy.wang; +Cc: linux-kernel, harryxiyou

From: anish kumar <anish198519851985@gmail.com>

The preferred form for passing a size of a struct is the following:
p = kmalloc(sizeof(*p), ...);
Please refer Documentation/Codingstyle chapter 14

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Acked-by: Harry Wei <harryxiyou@gmail.com>

---
 drivers/staging/sm7xx/smtcfb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
index 1aca0cb..c41d2f7 100644
--- a/drivers/staging/sm7xx/smtcfb.c
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -714,7 +714,7 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *dev,
 {
 	struct smtcfb_info *sfb;
 
-	sfb = kzalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
+	sfb = kzalloc(sizeof(*sfb), GFP_KERNEL);
 
 	if (!sfb)
 		return NULL;
-- 
1.7.0.4





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

* Re: [patch 2/3] Staging: sm7xx: preferred form for passing a size to memory allocation routines
  2011-05-18 17:12 anish
@ 2011-05-18 21:17 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-05-18 21:17 UTC (permalink / raw)
  To: anish; +Cc: teddy.wang, linux-kernel, harryxiyou

On Wed, May 18, 2011 at 10:42:08PM +0530, anish wrote:
>  The preferred form for passing a size of a struct is the following:
>          p = kmalloc(sizeof(*p), ...);
>  Please refer Documentation/Codingstyle chapter 14
> 
>  Signed-off-by: anish kumar <anish198519851985@gmail.com>
>  Acked-by: Harry Wei <harryxiyou@gmail.com>

What's with the extra spaces at the beginning of the lines?

And I never got patch 1/3 in my inbox.

You also need to put your full name in the "From:" line, like you did
for the signed-off-by: line.

So, care to try again?

thanks,

greg k-h

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

* [patch 2/3] Staging: sm7xx: preferred form for passing a size to memory allocation routines
@ 2011-05-18 17:12 anish
  2011-05-18 21:17 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: anish @ 2011-05-18 17:12 UTC (permalink / raw)
  To: greg, teddy.wang; +Cc: linux-kernel, harryxiyou

 The preferred form for passing a size of a struct is the following:
         p = kmalloc(sizeof(*p), ...);
 Please refer Documentation/Codingstyle chapter 14

 Signed-off-by: anish kumar <anish198519851985@gmail.com>
 Acked-by: Harry Wei <harryxiyou@gmail.com>

---
 drivers/staging/sm7xx/smtcfb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c
index 1aca0cb..c41d2f7 100644
--- a/drivers/staging/sm7xx/smtcfb.c
+++ b/drivers/staging/sm7xx/smtcfb.c
@@ -714,7 +714,7 @@ static struct smtcfb_info *smtc_alloc_fb_info(struct pci_dev *dev,
 {
 	struct smtcfb_info *sfb;
 
-	sfb = kzalloc(sizeof(struct smtcfb_info), GFP_KERNEL);
+	sfb = kzalloc(sizeof(*sfb), GFP_KERNEL);
 
 	if (!sfb)
 		return NULL;
-- 
1.7.0.4



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

end of thread, other threads:[~2011-05-19 15:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 15:28 [patch 2/3] Staging: sm7xx: preferred form for passing a size to memory allocation routines anish
  -- strict thread matches above, loose matches on Subject: below --
2011-05-18 17:12 anish
2011-05-18 21:17 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).