Re: [PATCH 2/2] mt9m111: Fix error handling in mt9m111_power_on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sakari,

On 19-06-18 14:59, Sakari Ailus wrote:
> 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@xxxxxxxxxxxxxxx>
> ---
>  drivers/media/i2c/mt9m111.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)

Looks good feel free to add

Reviewed-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>

Regards,
  Marco

> 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
> 
> 

-- 
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 |



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux