Message ID | 20180814100747.oovzd66gxmm755nr@kili.mountain (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | None | expand |
Hi Dan-san, Thank you so much. Looks good. Reviewed-by: Tokunori Ikegami <ikegami@allied-telesis.co.jp> Regards, Ikegami > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > Sent: Tuesday, August 14, 2018 7:08 PM > To: Jean Delvare; IKEGAMI Tokunori > Cc: Guenter Roeck; linux-hwmon@vger.kernel.org; > kernel-janitors@vger.kernel.org > Subject: [PATCH 2/2 v2] hwmon: (adt7475) Make adt7475_read_word() return > errors > > The adt7475_read_word() function was meant to return negative error > codes on failure. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- > v2: In my first patch I just removed the error handling in the callers > > diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c > index 90837f7c7d0f..ec03359536aa 100644 > --- a/drivers/hwmon/adt7475.c > +++ b/drivers/hwmon/adt7475.c > @@ -302,14 +302,18 @@ static inline u16 volt2reg(int channel, long volt, > u8 bypass_attn) > return clamp_val(reg, 0, 1023) & (0xff << 2); > } > > -static u16 adt7475_read_word(struct i2c_client *client, int reg) > +static int adt7475_read_word(struct i2c_client *client, int reg) > { > - u16 val; > + int val1, val2; > > - val = i2c_smbus_read_byte_data(client, reg); > - val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8); > + val1 = i2c_smbus_read_byte_data(client, reg); > + if (val1 < 0) > + return val1; > + val2 = i2c_smbus_read_byte_data(client, reg + 1); > + if (val2 < 0) > + return val2; > > - return val; > + return val1 | (val2 << 8); > } > > static void adt7475_write_word(struct i2c_client *client, int reg, u16 > val)
On Tue, Aug 14, 2018 at 01:07:47PM +0300, Dan Carpenter wrote: > The adt7475_read_word() function was meant to return negative error > codes on failure. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > Reviewed-by: Tokunori Ikegami <ikegami@allied-telesis.co.jp> Applied. Thanks, Guenter
Hi Guenter-san, Could you please let me know the git repository that applied the fixes by Dan-san? Regards, Ikegami > -----Original Message----- > From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter > Roeck > Sent: Tuesday, August 14, 2018 10:41 PM > To: Dan Carpenter > Cc: Jean Delvare; IKEGAMI Tokunori; linux-hwmon@vger.kernel.org; > kernel-janitors@vger.kernel.org > Subject: Re: [PATCH 2/2 v2] hwmon: (adt7475) Make adt7475_read_word() > return errors > > On Tue, Aug 14, 2018 at 01:07:47PM +0300, Dan Carpenter wrote: > > The adt7475_read_word() function was meant to return negative error > > codes on failure. > > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > Reviewed-by: Tokunori Ikegami <ikegami@allied-telesis.co.jp> > > Applied. > > Thanks, > Guenter
On 08/14/2018 11:02 PM, IKEGAMI Tokunori wrote: > Hi Guenter-san, > > Could you please let me know the git repository that applied the fixes by Dan-san? > Series now uploaded. I'll send a pull request to Linus after -rc1 has been published. git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon Guenter > Regards, > Ikegami > >> -----Original Message----- >> From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter >> Roeck >> Sent: Tuesday, August 14, 2018 10:41 PM >> To: Dan Carpenter >> Cc: Jean Delvare; IKEGAMI Tokunori; linux-hwmon@vger.kernel.org; >> kernel-janitors@vger.kernel.org >> Subject: Re: [PATCH 2/2 v2] hwmon: (adt7475) Make adt7475_read_word() >> return errors >> >> On Tue, Aug 14, 2018 at 01:07:47PM +0300, Dan Carpenter wrote: >>> The adt7475_read_word() function was meant to return negative error >>> codes on failure. >>> >>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> >>> Reviewed-by: Tokunori Ikegami <ikegami@allied-telesis.co.jp> >> >> Applied. >> >> Thanks, >> Guenter >
Hi Guenter-san, Thank you so much for the mail and noted it. (But sorry for too late to reply since the mail was automatically moved from the mail receiving folder.) Regards, Ikegami > -----Original Message----- > From: linux-hwmon-owner@vger.kernel.org > [mailto:linux-hwmon-owner@vger.kernel.org] On Behalf Of Guenter Roeck > Sent: Wednesday, August 15, 2018 9:37 PM > To: IKEGAMI Tokunori; Dan Carpenter > Cc: Jean Delvare; linux-hwmon@vger.kernel.org; > kernel-janitors@vger.kernel.org > Subject: Re: [PATCH 2/2 v2] hwmon: (adt7475) Make adt7475_read_word() > return errors > > On 08/14/2018 11:02 PM, IKEGAMI Tokunori wrote: > > Hi Guenter-san, > > > > Could you please let me know the git repository that applied the fixes > by Dan-san? > > > > Series now uploaded. I'll send a pull request to Linus after -rc1 has > been published. > > git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.g > it hwmon > > Guenter > > > Regards, > > Ikegami > > > >> -----Original Message----- > >> From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter > >> Roeck > >> Sent: Tuesday, August 14, 2018 10:41 PM > >> To: Dan Carpenter > >> Cc: Jean Delvare; IKEGAMI Tokunori; linux-hwmon@vger.kernel.org; > >> kernel-janitors@vger.kernel.org > >> Subject: Re: [PATCH 2/2 v2] hwmon: (adt7475) Make adt7475_read_word() > >> return errors > >> > >> On Tue, Aug 14, 2018 at 01:07:47PM +0300, Dan Carpenter wrote: > >>> The adt7475_read_word() function was meant to return negative error > >>> codes on failure. > >>> > >>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > >>> Reviewed-by: Tokunori Ikegami <ikegami@allied-telesis.co.jp> > >> > >> Applied. > >> > >> Thanks, > >> Guenter > >
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 90837f7c7d0f..ec03359536aa 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -302,14 +302,18 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn) return clamp_val(reg, 0, 1023) & (0xff << 2); } -static u16 adt7475_read_word(struct i2c_client *client, int reg) +static int adt7475_read_word(struct i2c_client *client, int reg) { - u16 val; + int val1, val2; - val = i2c_smbus_read_byte_data(client, reg); - val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8); + val1 = i2c_smbus_read_byte_data(client, reg); + if (val1 < 0) + return val1; + val2 = i2c_smbus_read_byte_data(client, reg + 1); + if (val2 < 0) + return val2; - return val; + return val1 | (val2 << 8); } static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
The adt7475_read_word() function was meant to return negative error codes on failure. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- v2: In my first patch I just removed the error handling in the callers