Small mt9m111 fixes
Subsystems (2)
Sakari Ailus
maintainercover Small mt9m111 fixes
Hi,
Here are a few simple fixes for the mt9m111 driver.
Sakari Ailus (2):
mt9m111: No need to check for the regulator
mt9m111: Fix error handling in mt9m111_power_on
drivers/media/i2c/mt9m111.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.11.0
Sakari Ailus
maintainerPATCH 1/2 mt9m111: No need to check for the regulator
The regulator_get() function returns a regulator when it succeeds. There's no need to check whether the regulator is NULL later on.
--- drivers/media/i2c/mt9m111.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/media/i2c/mt9m111.c +4 -7
@@ -984,11 +984,9 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)if (ret <0 )return ret; -if (mt9m111->regulator) { - ret =regulator_enable (mt9m111->regulator); -if (ret <0 ) -return ret; - } + ret =regulator_enable (mt9m111->regulator); +if (ret <0 ) +return ret; ret =mt9m111_resume (mt9m111);if (ret <0 ) {
@@ -1002,8 +1000,7 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)static void mt9m111_power_off (struct mt9m111 *mt9m111) {mt9m111_suspend (mt9m111); -if (mt9m111->regulator) -regulator_disable (mt9m111->regulator); +regulator_disable (mt9m111->regulator);v4l2_clk_disable (mt9m111->clk); }
Signature · 1 line
2.11.0
Re: [PATCH 1/2] mt9m111: No need to check for the regulator
Hi Sakari,
Quoted 7 lines · Sakari Ailus
The
regulator_get()function returns a regulator when it succeeds. There's no need to check whether the regulator is NULL later on.Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/i2c/mt9m111.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
Looks good feel free to add my
Regards,
Marco
Quoted 33 lines
drivers/media/i2c/mt9m111.c +4
-7@@ -984,11 +984,9 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)if (ret <0 )return ret; -if (mt9m111->regulator) { - ret =regulator_enable (mt9m111->regulator); -if (ret <0 ) -return ret; - } + ret =regulator_enable (mt9m111->regulator); +if (ret <0 ) +return ret; ret =mt9m111_resume (mt9m111);if (ret <0 ) {@@ -1002,8 +1000,7 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)static void mt9m111_power_off (struct mt9m111 *mt9m111) {mt9m111_suspend (mt9m111); -if (mt9m111->regulator) -regulator_disable (mt9m111->regulator); +regulator_disable (mt9m111->regulator);v4l2_clk_disable (mt9m111->clk); }Signature · 1 line
2.11.0
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Sakari Ailus
maintainerPATCH 2/2 mt9m111: Fix error handling in mt9m111_power_on
In reply to Sakari AilusThe mt9m111_power_on function did not properly clean up whenever it encountered an error. Do that now.
--- drivers/media/i2c/mt9m111.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/media/i2c/mt9m111.c +13 -5
@@ -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; }
Signature · 1 line
2.11.0
Re: [PATCH 2/2] mt9m111: Fix error handling in mt9m111_power_on
Hi Sakari,
Quoted 7 lines · Sakari Ailus
The
mt9m111_power_onfunction did not properly clean up whenever it encountered an error. Do that now.Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/i2c/mt9m111.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
Looks good feel free to add
Regards,
Marco
Quoted 35 lines
drivers/media/i2c/mt9m111.c +13
-5@@ -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; }Signature · 1 line
2.11.0
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |