From: Dan Carpenter <error27@gmail.com>
To: "Maxin B. John" <maxin.john@gmail.com>
Cc: Amit Kucheria <amit.kucheria@verdurent.com>,
devel@driverdev.osuosl.org, Arnd Bergmann <arnd@arndb.de>,
linux-iio@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org, Bryan Freed <bfreed@chromium.org>,
Jonathan Cameron <jic23@cam.ac.uk>
Subject: Re: [PATCH] staging: iio: light: Fix compiler warning in tsl2563.c
Date: Fri, 2 Sep 2011 00:55:40 +0300 [thread overview]
Message-ID: <20110901215540.GA2430@shale.localdomain> (raw)
In-Reply-To: <20110901212413.GA3371@maxin>
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
next prev parent reply other threads:[~2011-09-01 21:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 21:24 [PATCH] staging: iio: light: Fix compiler warning in tsl2563.c Maxin B. John
2011-09-01 21:55 ` Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-02 9:41 Maxin B. John
2011-09-02 10:55 ` Jonathan Cameron
2011-10-22 5:15 ` Maxin B John
2011-10-24 8:51 ` Jonathan Cameron
[not found] ` <20111024090143.GB3526@mwanda>
2011-10-24 9:14 ` Jonathan Cameron
[not found] ` <CAMhs6Yz6B_imMAthjjpymXj1garYzjFdzXfEArUwztmpgL4_hg@mail.gmail.com>
2011-10-24 9:15 ` Jonathan Cameron
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=20110901215540.GA2430@shale.localdomain \
--to=error27@gmail.com \
--cc=amit.kucheria@verdurent.com \
--cc=arnd@arndb.de \
--cc=bfreed@chromium.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxin.john@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).