linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: gregkh@linuxfoundation.org, lars@metafoo.de,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH V3 2/2] regmap: add regmap_bulk_write() for register write
Date: Sat, 11 Feb 2012 21:47:55 +0000	[thread overview]
Message-ID: <20120211214754.GF31887@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1328889628-13151-2-git-send-email-ldewangan@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-02-11 21:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 16:00 [PATCH V3 1/2] regmap: Support for caching in reg_raw_write() Laxman Dewangan
2012-02-10 16:00 ` [PATCH V3 2/2] regmap: add regmap_bulk_write() for register write Laxman Dewangan
2012-02-11 21:47   ` Mark Brown [this message]
     [not found] ` <1328889628-13151-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-02-11 23:05   ` [PATCH V3 1/2] regmap: Support for caching in reg_raw_write() Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120211214754.GF31887@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lars@metafoo.de \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).