From: Lad, Prabhakar Date: Fri, 17 Jan 2014 09:22:47 +0000 (-0300) Subject: [media] mt9v032: Check return value of clk_prepare_enable/clk_set_rate X-Git-Tag: firefly_0821_release~176^2~3573^2~667 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=79019190a4c3a082c739cf7cc73a040c48b333bb;p=firefly-linux-kernel-4.4.55.git [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 Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 36c504b78f2c..40172b8d8ea2 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/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); 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); /* Reset the chip and stop data read out */