public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Ira W. Snyder" <iws@ovro.caltech.edu>,
	"Darrick J. Wong" <djwong@us.ibm.com>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] hwmon: Fix checkpatch errors in lm90 driver
Date: Fri, 27 Aug 2010 06:49:26 -0700	[thread overview]
Message-ID: <20100827134926.GA21827@ericsson.com> (raw)
In-Reply-To: <20100827134523.6bcc70aa@hyperion.delvare>

On Fri, Aug 27, 2010 at 07:45:23AM -0400, Jean Delvare wrote:
> Hi Guenter,
> 
> On Thu, 26 Aug 2010 08:54:36 -0700, Guenter Roeck wrote:
> > Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
> > ---
> > The main rationale for this cleanup is to prepare the driver for adding max6696
> > support.
> 
> I'm fine with mostly anything, except...
> 
[...]
> >  	/* detection and identification */
> > -	if ((man_id = i2c_smbus_read_byte_data(new_client,
> > -						LM90_REG_R_MAN_ID)) < 0
> > -	 || (chip_id = i2c_smbus_read_byte_data(new_client,
> > -						LM90_REG_R_CHIP_ID)) < 0
> > -	 || (reg_config1 = i2c_smbus_read_byte_data(new_client,
> > -						LM90_REG_R_CONFIG1)) < 0
> > -	 || (reg_convrate = i2c_smbus_read_byte_data(new_client,
> > -						LM90_REG_R_CONVRATE)) < 0)
> > +	man_id = i2c_smbus_read_byte_data(new_client, LM90_REG_R_MAN_ID);
> > +	if (man_id < 0)
> > +		return -ENODEV;
> > +
> > +	chip_id = i2c_smbus_read_byte_data(new_client, LM90_REG_R_CHIP_ID);
> > +	if (chip_id < 0)
> > +		return -ENODEV;
> > +
> > +	reg_config1 = i2c_smbus_read_byte_data(new_client, LM90_REG_R_CONFIG1);
> > +	if (reg_config1 < 0)
> > +		return -ENODEV;
> > +
> > +	reg_convrate = i2c_smbus_read_byte_data(new_client,
> > +						LM90_REG_R_CONVRATE);
> > +	if (reg_convrate < 0)
> >  		return -ENODEV;
> 
> ... this. I think this check should be relaxed a bit, cascaded error
> checking is done in many drivers and I don't think this is anything to
> worry about.
> 
I agree. I struggled with that myself when I made the changes, but let checkpatch win.

> No need to resend, I've just dropped the two chunks I don't like, and
> applied the resulting patch. Thanks!
> 
Great, thanks. 

Next question: lm90_update_device() currently does not return any errors.
In recent drivers, we pass i2c read errors up to userland. Before I introduce
the max6696 changes, does it make sense to add error checking/return
into the driver, similar to what I have done in the smm665 and jc42 drivers ?

Guenter


  reply	other threads:[~2010-08-27 13:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 15:54 [PATCH] hwmon: Fix checkpatch errors in lm90 driver Guenter Roeck
2010-08-27 11:45 ` Jean Delvare
2010-08-27 13:49   ` Guenter Roeck [this message]
2010-08-27 15:24     ` Jean Delvare
2010-08-27 16:48       ` Guenter Roeck
2010-08-27 17:07         ` Jean Delvare

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=20100827134926.GA21827@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=akpm@linux-foundation.org \
    --cc=djwong@us.ibm.com \
    --cc=iws@ovro.caltech.edu \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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