* [patch 1/2] trivial: amba-clcd.c preferred form of passing size of
@ 2011-05-18 18:19 anish
2011-05-23 7:13 ` [patch 1/2] trivial: amba-clcd.c preferred form of passing size of structure Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: anish @ 2011-05-18 18:19 UTC (permalink / raw)
To: linux, lethal; +Cc: linux-fbdev, linux-kernel
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>
---
drivers/video/amba-clcd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 5fc983c..cb7ec86 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -549,7 +549,7 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
goto out;
}
- fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL);
+ fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb) {
printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
ret = -ENOMEM;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch 1/2] trivial: amba-clcd.c preferred form of passing size of structure
2011-05-18 18:19 [patch 1/2] trivial: amba-clcd.c preferred form of passing size of anish
@ 2011-05-23 7:13 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-05-23 7:13 UTC (permalink / raw)
To: anish; +Cc: linux, linux-fbdev, linux-kernel
On Wed, May 18, 2011 at 11:37:06PM +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>
>
That's pretty subjective, and ultimately depends on the author. I
personally prefer to have it written out, but then I don't randomly
change my structure types around either, so the "bug" alluded to isn't
really an issue. I'm not sure I buy the impaired readability argument,
either..
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-23 7:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-18 18:19 [patch 1/2] trivial: amba-clcd.c preferred form of passing size of anish
2011-05-23 7:13 ` [patch 1/2] trivial: amba-clcd.c preferred form of passing size of structure Paul Mundt
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).