On Thu, May 22, 2014 at 01:49:22PM -0400, Mark Hounschell wrote:
> I understand that unnecessarily initializing them is wrong. But if they
> do need initialized, is it preferred to do it in the declaration or in
> the code before it is used?
Which ever is more clear. It's up to you. Or do you mean code like
this?
1)
ret = -ENOMEM;
p = kmalloc();
if (!p)
goto err_free_x;
2)
p = kmalloc();
if (!p) {
ret = -ENOMEM;
goto err_free_x;
}
That's also up to the maintainer. People debate which one is cleaner.
I normally do the second one, unless the rest of the file does the first
one. The first one apparently is slightly better assembly on current
GCCs.
regards,
dan carpenter
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel