[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110901215540.GA2430@shale.localdomain>
Date: Fri, 2 Sep 2011 00:55:40 +0300
From: Dan Carpenter <error27@...il.com>
To: "Maxin B. John" <maxin.john@...il.com>
Cc: Amit Kucheria <amit.kucheria@...durent.com>,
devel@...verdev.osuosl.org, Arnd Bergmann <arnd@...db.de>,
linux-iio@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
linux-kernel@...r.kernel.org, Bryan Freed <bfreed@...omium.org>,
Jonathan Cameron <jic23@....ac.uk>
Subject: Re: [PATCH] staging: iio: light: Fix compiler warning in tsl2563.c
On Fri, Sep 02, 2011 at 12:24:13AM +0300, Maxin B. John wrote:
> --- a/drivers/staging/iio/light/tsl2563.c
> +++ b/drivers/staging/iio/light/tsl2563.c
> @@ -225,9 +225,9 @@ 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;
> + return -EIO;
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.
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).
(In other words, don't make any changes to the tsl2563_probe()
function)
>
> - return 0;
> + return ret;
> }
>
regards,
dan carpenter
--
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