All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Javier Martin <javier.martin@vista-silicon.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	carlighting@yahoo.co.nz, beagleboard@googlegroups.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor.
Date: Mon, 23 May 2011 11:26:38 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1105231123100.30305@axis700.grange> (raw)
In-Reply-To: <201105231103.26775.laurent.pinchart@ideasonboard.com>

On Mon, 23 May 2011, Laurent Pinchart wrote:

> > > +{
> > > +	struct mt9p031 *mt9p031 = to_mt9p031(client);
> > > +	int ret;
> > > +
> > > +	/* Disable chip output, synchronous option update */
> > > +	ret = reg_write(client, MT9P031_RST, MT9P031_RST_ENABLE);
> > > +	if (ret < 0)
> > > +		return -EIO;
> > > +	ret = reg_write(client, MT9P031_RST, MT9P031_RST_DISABLE);
> > > +	if (ret < 0)
> > > +		return -EIO;
> > > +	ret = mt9p031_set_output_control(mt9p031, MT9P031_OUTPUT_CONTROL_CEN,
> > > 0); +	if (ret < 0)
> > > +		return -EIO;
> > > +	return 0;
> > 
> > I think, a sequence like
> > 
> > 	ret = fn();
> > 	if (!ret)
> > 		ret = fn();
> > 	if (!ret)
> > 		ret = fn();
> > 	return ret;
> > 
> > is a better way to achieve the same.
> 
> I disagree with you on that :-) I find code sequences that return as soon as 
> an error occurs, using the main code path for the error-free case, easier to 
> read. It can be a matter of personal taste though.

Whichever way, but it should be consistent, IMHO.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

WARNING: multiple messages have this Message-ID (diff)
From: g.liakhovetski@gmx.de (Guennadi Liakhovetski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor.
Date: Mon, 23 May 2011 11:26:38 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1105231123100.30305@axis700.grange> (raw)
In-Reply-To: <201105231103.26775.laurent.pinchart@ideasonboard.com>

On Mon, 23 May 2011, Laurent Pinchart wrote:

> > > +{
> > > +	struct mt9p031 *mt9p031 = to_mt9p031(client);
> > > +	int ret;
> > > +
> > > +	/* Disable chip output, synchronous option update */
> > > +	ret = reg_write(client, MT9P031_RST, MT9P031_RST_ENABLE);
> > > +	if (ret < 0)
> > > +		return -EIO;
> > > +	ret = reg_write(client, MT9P031_RST, MT9P031_RST_DISABLE);
> > > +	if (ret < 0)
> > > +		return -EIO;
> > > +	ret = mt9p031_set_output_control(mt9p031, MT9P031_OUTPUT_CONTROL_CEN,
> > > 0); +	if (ret < 0)
> > > +		return -EIO;
> > > +	return 0;
> > 
> > I think, a sequence like
> > 
> > 	ret = fn();
> > 	if (!ret)
> > 		ret = fn();
> > 	if (!ret)
> > 		ret = fn();
> > 	return ret;
> > 
> > is a better way to achieve the same.
> 
> I disagree with you on that :-) I find code sequences that return as soon as 
> an error occurs, using the main code path for the error-free case, easier to 
> read. It can be a matter of personal taste though.

Whichever way, but it should be consistent, IMHO.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

  reply	other threads:[~2011-05-23  9:26 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20 13:47 [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor Javier Martin
2011-05-20 13:47 ` Javier Martin
2011-05-20 13:47 ` [PATCH v2 2/2] OMAP3BEAGLE: Add support for mt9p031 sensor driver Javier Martin
2011-05-20 13:47   ` Javier Martin
2011-05-20 15:57   ` [beagleboard] " Koen Kooi
2011-05-20 15:57     ` Koen Kooi
2011-05-23  7:01     ` javier Martin
2011-05-23  7:01       ` javier Martin
2011-05-23  8:00       ` Laurent Pinchart
2011-05-23  8:00         ` Laurent Pinchart
2011-05-23  8:55         ` Koen Kooi
2011-05-23  8:55           ` Koen Kooi
2011-05-23  9:14           ` Laurent Pinchart
2011-05-23  9:14             ` Laurent Pinchart
2011-05-22 13:49   ` Igor Grinberg
2011-05-22 13:49     ` Igor Grinberg
2011-05-23  7:25     ` javier Martin
2011-05-23  7:25       ` javier Martin
2011-05-23  7:25       ` javier Martin
2011-05-23  7:47       ` Laurent Pinchart
2011-05-23  7:47         ` Laurent Pinchart
2011-05-23 17:03         ` Igor Grinberg
2011-05-23 17:03           ` Igor Grinberg
2011-05-21 12:55 ` [PATCH v2 1/2] MT9P031: Add support for Aptina mt9p031 sensor Mauro Carvalho Chehab
2011-05-21 12:55   ` Mauro Carvalho Chehab
2011-05-22 20:41   ` Laurent Pinchart
2011-05-22 20:41     ` Laurent Pinchart
2011-05-21 15:29 ` Guennadi Liakhovetski
2011-05-21 15:29   ` Guennadi Liakhovetski
2011-05-23  8:20   ` javier Martin
2011-05-23  8:20     ` javier Martin
2011-05-23  8:48     ` Guennadi Liakhovetski
2011-05-23  8:48       ` Guennadi Liakhovetski
2011-05-23  9:08       ` Laurent Pinchart
2011-05-23  9:08         ` Laurent Pinchart
2011-05-23  9:03   ` Laurent Pinchart
2011-05-23  9:03     ` Laurent Pinchart
2011-05-23  9:26     ` Guennadi Liakhovetski [this message]
2011-05-23  9:26       ` Guennadi Liakhovetski
2011-05-24  8:31     ` javier Martin
2011-05-24  8:31       ` javier Martin
2011-05-24  8:39       ` Laurent Pinchart
2011-05-24  8:39         ` Laurent Pinchart
2011-05-24  8:56         ` javier Martin
2011-05-24  8:56           ` javier Martin
2011-05-24  8:58           ` Laurent Pinchart
2011-05-24  8:58             ` Laurent Pinchart
2011-05-23  3:01 Chris Rodley
2011-05-23  6:54 ` javier Martin
2011-05-24  5:03 Chris Rodley
2011-05-25  3:45 Chris Rodley
2011-05-25  7:00 ` javier Martin
2011-05-25  7:00   ` javier Martin

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=Pine.LNX.4.64.1105231123100.30305@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=beagleboard@googlegroups.com \
    --cc=carlighting@yahoo.co.nz \
    --cc=javier.martin@vista-silicon.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.