From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Robert Jarzmik <robert.jarzmik@free.fr>,
Akinobu Mita <akinobu.mita@gmail.com>,
Marco Felsch <m.felsch@pengutronix.de>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Enrico Scholz <enrico.scholz@sigma-chemnitz.de>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Subject: [PATCH 2/2] mt9m111: Fix error handling in mt9m111_power_on
Date: Tue, 18 Jun 2019 14:59:10 +0300 [thread overview]
Message-ID: <20190618115910.17272-3-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20190618115910.17272-1-sakari.ailus@linux.intel.com>
The mt9m111_power_on function did not properly clean up whenever it
encountered an error. Do that now.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/mt9m111.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index bb19f8c346cb..593ebe5e2cb6 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -986,13 +986,21 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)
ret = regulator_enable(mt9m111->regulator);
if (ret < 0)
- return ret;
+ goto out_clk_disable;
ret = mt9m111_resume(mt9m111);
- if (ret < 0) {
- dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret);
- v4l2_clk_disable(mt9m111->clk);
- }
+ if (ret < 0)
+ goto out_regulator_disable;
+
+ return 0;
+
+out_regulator_disable:
+ regulator_disable(mt9m111->regulator);
+
+out_clk_disable:
+ v4l2_clk_disable(mt9m111->clk);
+
+ dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret);
return ret;
}
--
2.11.0
next prev parent reply other threads:[~2019-06-18 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 11:59 [PATCH 0/2] Small mt9m111 fixes Sakari Ailus
2019-06-18 11:59 ` [PATCH 1/2] mt9m111: No need to check for the regulator Sakari Ailus
2019-06-20 9:15 ` Marco Felsch
2019-06-18 11:59 ` Sakari Ailus [this message]
2019-06-20 9:13 ` [PATCH 2/2] mt9m111: Fix error handling in mt9m111_power_on Marco Felsch
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=20190618115910.17272-3-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=akinobu.mita@gmail.com \
--cc=enrico.scholz@sigma-chemnitz.de \
--cc=linux-media@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=m.grzeschik@pengutronix.de \
--cc=mchehab+samsung@kernel.org \
--cc=robert.jarzmik@free.fr \
/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).