From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ppsw-51.csi.cam.ac.uk ([131.111.8.151]:42766 "EHLO ppsw-51.csi.cam.ac.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313Ab1IBKrm (ORCPT ); Fri, 2 Sep 2011 06:47:42 -0400 Message-ID: <4E60B63C.1030101@cam.ac.uk> Date: Fri, 02 Sep 2011 11:55:56 +0100 From: Jonathan Cameron MIME-Version: 1.0 To: "Maxin B. John" CC: Dan Carpenter , Bryan Freed , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-iio@vger.kernel.org, Arnd Bergmann , devel@driverdev.osuosl.org, Amit Kucheria Subject: Re: [PATCH] staging: iio: light: Fix compiler warning in tsl2563.c References: <20110902094107.GA2846@maxin> In-Reply-To: <20110902094107.GA2846@maxin> Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org On 09/02/11 10:41, Maxin B. John wrote: >> Don't overwrite the error code. For example, the lower layers can >> return -EAGAIN and that's more useful than just returning -EIO every >> time. > Ahh.. Thanks a lot for explaining this. > >> Your fix works, but it's not very clean. Just add a "*id = ret;" >> line before the "return 0;" and that's it. (It doesn't make sense >> to pass a pointer to "id" and not use it). > Dan, yes, I agree with you. This fix is much much better than what I > had in my mind. > >> Yikes - I wonder why my various compilers don't throw that up. > I guess, in "iio-blue.git" tree, the 'id = 0' suppresses this warning. That'd do it. oops. Ideally keep the white space but doesn't really matter. Either send on to Greg directly or I'll add it to iio-blue and send on with the next fixes series - probably this afternoon. > > Signed-off-by: Maxin B. John Acked-by: Jonathan Cameron > --- > diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c > index f25243b..55012ff 100644 > --- a/drivers/staging/iio/light/tsl2563.c > +++ b/drivers/staging/iio/light/tsl2563.c > @@ -226,7 +226,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id) > ret = i2c_smbus_read_byte_data(client, TSL2563_CMD | TSL2563_REG_ID); > if (ret < 0) > return ret; > - > + *id = ret; > return 0; > } > >