lkml.org 
[lkml]   [2012]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 2/2] regmap: add regmap_bulk_write() for register write
On Fri, Feb 10, 2012 at 09:30:28PM +0530, Laxman Dewangan wrote:

> + /* No formatting is require if val_byte is 1 */
> + if (val_bytes == 1)
> + wval = (void *)val;
> + else {

Please don't combine branches with and without braces.

> + wval = kmemdup(val, val_count * val_bytes, GFP_KERNEL);
> + if (!wval) {
> + mutex_unlock(&map->lock);
> + dev_err(map->dev,
> + "Error in memory allocation\n");
> + return -ENOMEM;

As a style thing a goto error pattern is clearer for stuff like this -
there's so many branches that it's complex to keep track of the
unwinding.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-02-11 22:51    [W:0.929 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site