Browse Source

[media] mt9v032: Check return value of clk_prepare_enable/clk_set_rate

clk_set_rate(), clk_prepare_enable() functions can fail, so check the return
values to avoid surprises.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Lad, Prabhakar 11 years ago
parent
commit
79019190a4
1 changed files with 8 additions and 2 deletions
  1. 8 2
      drivers/media/i2c/mt9v032.c

+ 8 - 2
drivers/media/i2c/mt9v032.c

@@ -317,8 +317,14 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9v032->subdev);
 	struct i2c_client *client = v4l2_get_subdevdata(&mt9v032->subdev);
 	int ret;
 	int ret;
 
 
-	clk_set_rate(mt9v032->clk, mt9v032->sysclk);
-	clk_prepare_enable(mt9v032->clk);
+	ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_prepare_enable(mt9v032->clk);
+	if (ret)
+		return ret;
+
 	udelay(1);
 	udelay(1);
 
 
 	/* Reset the chip and stop data read out */
 	/* Reset the chip and stop data read out */