From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: Todor Tomov <todor.tomov@linaro.org>
Cc: sakari.ailus@linux.intel.com, hverkuil@xs4all.nl,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] media: ov5645: Fix write_reg return code
Date: Tue, 6 Mar 2018 10:40:10 -0300 [thread overview]
Message-ID: <20180306104010.234737a6@vento.lan> (raw)
In-Reply-To: <1518082920-11309-1-git-send-email-todor.tomov@linaro.org>
Em Thu, 8 Feb 2018 11:41:59 +0200
Todor Tomov <todor.tomov@linaro.org> escreveu:
> I2C transfer functions return number of successful operations (on success).
>
> Do not return the received positive return code but instead return 0 on
> success. The users of write_reg function already use this logic.
>
> Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
> ---
> drivers/media/i2c/ov5645.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> index d28845f..9755562 100644
> --- a/drivers/media/i2c/ov5645.c
> +++ b/drivers/media/i2c/ov5645.c
> @@ -600,11 +600,13 @@ static int ov5645_write_reg(struct ov5645 *ov5645, u16 reg, u8 val)
> regbuf[2] = val;
>
> ret = i2c_master_send(ov5645->i2c_client, regbuf, 3);
> - if (ret < 0)
> + if (ret < 0) {
> dev_err(ov5645->dev, "%s: write reg error %d: reg=%x, val=%x\n",
> __func__, ret, reg, val);
> + return ret;
> + }
Actually, if ret < 3, it should return an error too (like -EREMOTEIO
or -EIO).
>
> - return ret;
> + return 0;
> }
>
> static int ov5645_read_reg(struct ov5645 *ov5645, u16 reg, u8 *val)
Thanks,
Mauro
next prev parent reply other threads:[~2018-03-06 13:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 9:41 [PATCH 1/2] media: ov5645: Fix write_reg return code Todor Tomov
2018-02-08 9:42 ` [PATCH 2/2] media: ov5645: Improve mode finding function Todor Tomov
2018-03-06 13:58 ` Sakari Ailus
2018-03-06 13:40 ` Mauro Carvalho Chehab [this message]
2018-03-06 13:56 ` [PATCH 1/2] media: ov5645: Fix write_reg return code Sakari Ailus
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=20180306104010.234737a6@vento.lan \
--to=mchehab@kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=todor.tomov@linaro.org \
/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