diff mbox

[2/5] mt9m111: fix missing return value check mt9m111_reg_clear

Message ID 1310485146-27759-2-git-send-email-m.grzeschik@pengutronix.de (mailing list archive)
State Under Review
Headers show

Commit Message

Michael Grzeschik July 12, 2011, 3:39 p.m. UTC
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/media/video/mt9m111.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Guennadi Liakhovetski July 17, 2011, 4:54 p.m. UTC | #1
On Tue, 12 Jul 2011, Michael Grzeschik wrote:

> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Applied, thanks

> ---
>  drivers/media/video/mt9m111.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
> index f10dcf0..e08b46c 100644
> --- a/drivers/media/video/mt9m111.c
> +++ b/drivers/media/video/mt9m111.c
> @@ -248,7 +248,9 @@ static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg,
>  	int ret = 0;
>  
>  	ret = mt9m111_reg_read(client, reg);
> -	return mt9m111_reg_write(client, reg, ret & ~data);
> +	if (ret >= 0)
> +		ret = mt9m111_reg_write(client, reg, ret & ~data);
> +	return ret;
>  }
>  
>  static int mt9m111_set_context(struct i2c_client *client,
> -- 
> 1.7.5.4
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index f10dcf0..e08b46c 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -248,7 +248,9 @@  static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg,
 	int ret = 0;
 
 	ret = mt9m111_reg_read(client, reg);
-	return mt9m111_reg_write(client, reg, ret & ~data);
+	if (ret >= 0)
+		ret = mt9m111_reg_write(client, reg, ret & ~data);
+	return ret;
 }
 
 static int mt9m111_set_context(struct i2c_client *client,