[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100827134926.GA21827@ericsson.com>
Date: Fri, 27 Aug 2010 06:49:26 -0700
From: Guenter Roeck <guenter.roeck@...csson.com>
To: Jean Delvare <khali@...ux-fr.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
"Ira W. Snyder" <iws@...o.caltech.edu>,
"Darrick J. Wong" <djwong@...ibm.com>,
"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hwmon: Fix checkpatch errors in lm90 driver
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@...csson.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists