From: Colin King <colin.king@canonical.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
linux-media@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: i2c: adp1653: fix error handling from a call to adp1653_get_fault
Date: Fri, 26 Feb 2021 23:22:29 +0000 [thread overview]
Message-ID: <20210226232229.1076199-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
The error check on rval from the call to adp1653_get_fault currently
returns if rval is non-zero. This appears to be incorrect as the
following if statement checks for various bit settings in rval so
clearly rval is expected to be non-zero at that point. Coverity
flagged the if statement up as deadcode. Fix this so the error
return path only occurs when rval is negative.
Addresses-Coverity: ("Logically dead code")
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/media/i2c/adp1653.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 522a0b10e415..1a4878385394 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -170,7 +170,7 @@ static int adp1653_set_ctrl(struct v4l2_ctrl *ctrl)
int rval;
rval = adp1653_get_fault(flash);
- if (rval)
+ if (rval < 0)
return rval;
if ((rval & (ADP1653_REG_FAULT_FLT_SCP |
ADP1653_REG_FAULT_FLT_OT |
--
2.30.0
next reply other threads:[~2021-02-26 23:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 23:22 Colin King [this message]
2021-02-27 10:17 ` [PATCH] media: i2c: adp1653: fix error handling from a call to adp1653_get_fault Dan Carpenter
2021-03-01 7:10 ` 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=20210226232229.1076199-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=arnd@arndb.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=srinivas.kandagatla@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;
as well as URLs for NNTP newsgroup(s).