diff mbox series

media: ov772x: Disable clk on error path

Message ID 1534363839-28509-1-git-send-email-khoroshilov@ispras.ru (mailing list archive)
State New, archived
Headers show
Series media: ov772x: Disable clk on error path | expand

Commit Message

Alexey Khoroshilov Aug. 15, 2018, 8:10 p.m. UTC
If ov772x_power_on() is unable to get GPIO rstb,
the clock is left undisabled.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/media/i2c/ov772x.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jacopo Mondi Aug. 16, 2018, 10:13 a.m. UTC | #1
Hello Alexey,
   thanks for the patch

On Wed, Aug 15, 2018 at 11:10:39PM +0300, Alexey Khoroshilov wrote:
> If ov772x_power_on() is unable to get GPIO rstb,
> the clock is left undisabled.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>

Acked-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Thanks
   j

> ---
>  drivers/media/i2c/ov772x.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
> index e2550708abc8..7b62bf1fc5b1 100644
> --- a/drivers/media/i2c/ov772x.c
> +++ b/drivers/media/i2c/ov772x.c
> @@ -828,6 +828,7 @@ static int ov772x_power_on(struct ov772x_priv *priv)
>  					     GPIOD_OUT_LOW);
>  	if (IS_ERR(priv->rstb_gpio)) {
>  		dev_info(&client->dev, "Unable to get GPIO \"rstb\"");
> +		clk_disable_unprepare(priv->clk);
>  		return PTR_ERR(priv->rstb_gpio);
>  	}
>
> --
> 2.7.4
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index e2550708abc8..7b62bf1fc5b1 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -828,6 +828,7 @@  static int ov772x_power_on(struct ov772x_priv *priv)
 					     GPIOD_OUT_LOW);
 	if (IS_ERR(priv->rstb_gpio)) {
 		dev_info(&client->dev, "Unable to get GPIO \"rstb\"");
+		clk_disable_unprepare(priv->clk);
 		return PTR_ERR(priv->rstb_gpio);
 	}