From: jacopo mondi <jacopo@jmondi.org>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@s-opensource.com>
Subject: Re: [PATCH 2/6] media: ov772x: add checks for register read errors
Date: Mon, 9 Apr 2018 09:36:17 +0200 [thread overview]
Message-ID: <20180409073614.GV20945@w540> (raw)
In-Reply-To: <1523116090-13101-3-git-send-email-akinobu.mita@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]
Hi Akinobu,
On Sun, Apr 08, 2018 at 12:48:06AM +0900, Akinobu Mita wrote:
> This change adds checks for register read errors and returns correct
> error code.
>
I feel like error conditions are anyway captured by the switch()
default case, but I understand there may be merits in returning the
actual error code.
> Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
> drivers/media/i2c/ov772x.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
> index 283ae2c..c56f910 100644
> --- a/drivers/media/i2c/ov772x.c
> +++ b/drivers/media/i2c/ov772x.c
> @@ -1169,8 +1169,15 @@ static int ov772x_video_probe(struct ov772x_priv *priv)
> return ret;
>
> /* Check and show product ID and manufacturer ID. */
> - pid = ov772x_read(client, PID);
> - ver = ov772x_read(client, VER);
> + ret = ov772x_read(client, PID);
> + if (ret < 0)
> + return ret;
> + pid = ret;
> +
> + ret = ov772x_read(client, VER);
> + if (ret < 0)
> + return ret;
> + ver = ret;
You can assign the ov772x_read() return value to pid and ver directly
and save two assignments.
>
> switch (VERSION(pid, ver)) {
> case OV7720:
If we want to check for return values here, which is always a good
thing, could you do the same for MIDH and MIDL below?
Nit: You can also fix the dev_info() parameters alignment to span to
the whole line length while at there. Ie.
dev_info(&client->dev,
"%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
devname, pid, ver, ov772x_read(client, MIDH),
ov772x_read(client, MIDL));
Thanks
j
> --
> 2.7.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2018-04-09 7:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-07 15:48 [PATCH 0/6] media: ov772x: support media controller, device tree probing, etc Akinobu Mita
2018-04-07 15:48 ` [PATCH 1/6] media: ov772x: allow i2c controllers without I2C_FUNC_PROTOCOL_MANGLING Akinobu Mita
2018-04-09 6:58 ` jacopo mondi
2018-04-09 11:55 ` Laurent Pinchart
2018-04-10 16:37 ` Akinobu Mita
2018-04-11 7:32 ` jacopo mondi
2018-04-07 15:48 ` [PATCH 2/6] media: ov772x: add checks for register read errors Akinobu Mita
2018-04-09 7:36 ` jacopo mondi [this message]
2018-04-10 16:28 ` Akinobu Mita
2018-04-07 15:48 ` [PATCH 3/6] media: ov772x: create subdevice device node Akinobu Mita
2018-04-07 15:48 ` [PATCH 4/6] media: ov772x: add media controller support Akinobu Mita
2018-04-09 8:32 ` jacopo mondi
2018-04-10 16:31 ` Akinobu Mita
2018-04-07 15:48 ` [PATCH 5/6] media: ov772x: add device tree binding Akinobu Mita
2018-04-09 9:06 ` jacopo mondi
2018-04-10 16:34 ` Akinobu Mita
2018-04-07 15:48 ` [PATCH 6/6] media: ov772x: support device tree probing Akinobu Mita
2018-04-09 9:27 ` jacopo mondi
2018-04-10 16:34 ` Akinobu Mita
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=20180409073614.GV20945@w540 \
--to=jacopo@jmondi.org \
--cc=akinobu.mita@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=hans.verkuil@cisco.com \
--cc=jacopo+renesas@jmondi.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@s-opensource.com \
--cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.