lkml.org 
[lkml]   [2013]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] drivers: mfd: sec-code: Fix sizeof argument
From
Date
On Fri, 2013-05-17 at 20:50 +0300, Leon Romanovsky wrote:
> On Fri, May 17, 2013 at 1:13 AM, Samuel Ortiz <sameo@linux.intel.com> wrote:
> > On Wed, May 15, 2013 at 01:53:56PM +0300, Leon Romanovsky wrote:
> >> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
[]
> >> @@ -121,7 +121,7 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(
[]
> >> - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
> >> + pd = devm_kzalloc(dev, sizeof(struct sec_platform_data), GFP_KERNEL);
> > How is that fixing anything ?
> Technically you are right, this fix brings code to be align to common
> code convention and allows to automatic tools correctly parse it.

Not really.
Common coding convention is actually the original code.

from: Documentation/CodingStyle:

Chapter 14: Allocating memory
[]
The preferred form for passing a size of a struct is the following:

p = kmalloc(sizeof(*p), ...);




\
 
 \ /
  Last update: 2013-05-17 20:21    [W:0.057 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site