Re: [PATCH 1/2] mt9m111: No need to check for the regulator

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

 



Hi Sakari,

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

Looks good feel free to add my

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

Regards,
  Marco

> diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> index 746d1345b505..bb19f8c346cb 100644
> --- a/drivers/media/i2c/mt9m111.c
> +++ b/drivers/media/i2c/mt9m111.c
> @@ -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);
>  }
>  
> -- 
> 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