Commit 75b090a5 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab

media: sr030pc30: remove NULL in sr030pc30_base_config()

This code doesn't check for NULL consistently and it generates a Smatch
warning:

    drivers/media/i2c/sr030pc30.c:575 sr030pc30_base_config()
    error: we previously assumed 'info->pdata' could be null (see line 572)

Fortunately, "info->pdata" can't be NULL to that check can be removed.
The other thing is that if "ret" is an error code here, then we don't
want to do the next call to cam_i2c_write(), so actually let's flip that
test around and return the error.  This is more of a theoretical issue
than something which is likely to affect real life.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 7d3073f1
...@@ -569,7 +569,7 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd) ...@@ -569,7 +569,7 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd)
if (!ret) if (!ret)
ret = sr030pc30_pwr_ctrl(sd, false, false); ret = sr030pc30_pwr_ctrl(sd, false, false);
if (!ret && !info->pdata) if (ret)
return ret; return ret;
expmin = EXPOS_MIN_MS * info->pdata->clk_rate / (8 * 1000); expmin = EXPOS_MIN_MS * info->pdata->clk_rate / (8 * 1000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment