[media] V4L: mt9m111: fix missing return value check mt9m111_reg_clear
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Tue, 12 Jul 2011 15:39:03 +0000 (12:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 27 Jul 2011 20:56:09 +0000 (17:56 -0300)
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/mt9m111.c

index cbccc869c7e18612ff35047f08e116a7b42cd364..8d8420acc9cf2d2ae85bb1d908ccb24b3a6e3b57 100644 (file)
@@ -250,7 +250,9 @@ static int mt9m111_reg_clear(struct i2c_client *client, const u16 reg,
        int ret;
 
        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 mt9m111 *mt9m111,