Re: [PATCH] drivers: Conversions from kmalloc+memset tok(z|c)alloc.

Panagiotis Issaris
2006-07-21T09:32:37Z

Hi,

On vr, 2006-07-21 at 03:05 -0400, Jeff Garzik wrote:
> Pekka Enberg wrote:
> > On 7/21/06, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
> >> > - if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
> >> > + handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
> >> > + if (!handle)
> >> > return NULL;
> >>
> >> sizeof(*handle)?
> >
> > In general, yes. However, some maintainers don't like that, so I would
> > recommend to keep them as-is unless you get a clear ack from the
> > maintainer to change it.
>
> Strongly agreed. Follow the style of the existing code as closely as
> possible, and resist the temptation of making little "improvements"
> while you are doing a task...

Ah okay. Up until now, I thought it would be okay to change the style of
the code if it was listed in the CodingStyle document and in any other
cause should be left untouched as it would be left to the maintainers
personal preference. That's why I explicitly asked about the "if ((buf =
kmalloc(...)==NULL) -> buf = kmalloc(...); if (!buf)" type of changes.

Ofcourse, I should have put cosmetic changes in a separate patch anyway.

With friendly regards,
Takis