From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-media@vger.kernel.org, Hans Verkuil <hansverk@cisco.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Todor Tomov <todor.tomov@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] [media] ov5645: Move an error code assignment in ov5645_probe()
Date: Wed, 14 Mar 2018 21:15:43 +0000 [thread overview]
Message-ID: <4efad917-ca08-f257-e9a1-b5bcb7df2df2@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 14 Mar 2018 22:02:52 +0100
Move an assignment for a specific error code so that it is stored only once
in this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/i2c/ov5645.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index d28845f7356f..374576380fd4 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -1284,13 +1284,11 @@ static int ov5645_probe(struct i2c_client *client,
ret = ov5645_read_reg(ov5645, OV5645_CHIP_ID_HIGH, &chip_id_high);
if (ret < 0 || chip_id_high != OV5645_CHIP_ID_HIGH_BYTE) {
dev_err(dev, "could not read ID high\n");
- ret = -ENODEV;
goto power_down;
}
ret = ov5645_read_reg(ov5645, OV5645_CHIP_ID_LOW, &chip_id_low);
if (ret < 0 || chip_id_low != OV5645_CHIP_ID_LOW_BYTE) {
dev_err(dev, "could not read ID low\n");
- ret = -ENODEV;
goto power_down;
}
@@ -1300,7 +1298,6 @@ static int ov5645_probe(struct i2c_client *client,
&ov5645->aec_pk_manual);
if (ret < 0) {
dev_err(dev, "could not read AEC/AGC mode\n");
- ret = -ENODEV;
goto power_down;
}
@@ -1308,7 +1305,6 @@ static int ov5645_probe(struct i2c_client *client,
&ov5645->timing_tc_reg20);
if (ret < 0) {
dev_err(dev, "could not read vflip value\n");
- ret = -ENODEV;
goto power_down;
}
@@ -1316,7 +1312,6 @@ static int ov5645_probe(struct i2c_client *client,
&ov5645->timing_tc_reg21);
if (ret < 0) {
dev_err(dev, "could not read hflip value\n");
- ret = -ENODEV;
goto power_down;
}
@@ -1334,6 +1329,7 @@ static int ov5645_probe(struct i2c_client *client,
power_down:
ov5645_s_power(&ov5645->sd, false);
+ ret = -ENODEV;
free_entity:
media_entity_cleanup(&ov5645->sd.entity);
free_ctrl:
--
2.16.2
next reply other threads:[~2018-03-14 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 21:15 SF Markus Elfring [this message]
2018-03-14 22:17 ` [PATCH] [media] ov5645: Move an error code assignment in ov5645_probe() Sakari Ailus
2018-03-15 8:57 ` Todor Tomov
2018-03-15 9:34 ` SF Markus Elfring
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=4efad917-ca08-f257-e9a1-b5bcb7df2df2@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=hansverk@cisco.com \
--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=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