devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-media@vger.kernel.org, devicetree@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	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: [PATCH 2/6] media: ov772x: add checks for register read errors
Date: Sun,  8 Apr 2018 00:48:06 +0900	[thread overview]
Message-ID: <1523116090-13101-3-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1523116090-13101-1-git-send-email-akinobu.mita@gmail.com>

This change adds checks for register read errors and returns correct
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;
 
 	switch (VERSION(pid, ver)) {
 	case OV7720:
-- 
2.7.4


  parent reply	other threads:[~2018-04-07 15:48 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 ` Akinobu Mita [this message]
2018-04-09  7:36   ` [PATCH 2/6] media: ov772x: add checks for register read errors jacopo mondi
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=1523116090-13101-3-git-send-email-akinobu.mita@gmail.com \
    --to=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 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).