diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-02-07 04:13:38 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-02-07 12:38:24 -0500 |
commit | db89a47fb9c71e769b817fa669631b04c2aba440 (patch) | |
tree | 91182f129cf9edba20a7ea1a3c6a72f3517814e8 | |
parent | d75e77ed14f86034ace17e65ab6a6261dd0858c2 (diff) |
media: pxa_camera: fix smatch warning
drivers/media/platform/pxa_camera.c:2400 pxa_camera_probe() error: we previously assumed 'pcdev->pdata' could be null (see line 2397)
First check if platform data is provided, then check if DT data is provided,
and if neither is provided just return with -ENODEV.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r-- | drivers/media/platform/pxa_camera.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index 5f930560eb30..3cf3c6390cc8 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c | |||
@@ -2394,15 +2394,17 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
2394 | pcdev->res = res; | 2394 | pcdev->res = res; |
2395 | 2395 | ||
2396 | pcdev->pdata = pdev->dev.platform_data; | 2396 | pcdev->pdata = pdev->dev.platform_data; |
2397 | if (pdev->dev.of_node && !pcdev->pdata) { | 2397 | if (pcdev->pdata) { |
2398 | err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd); | ||
2399 | } else { | ||
2400 | pcdev->platform_flags = pcdev->pdata->flags; | 2398 | pcdev->platform_flags = pcdev->pdata->flags; |
2401 | pcdev->mclk = pcdev->pdata->mclk_10khz * 10000; | 2399 | pcdev->mclk = pcdev->pdata->mclk_10khz * 10000; |
2402 | pcdev->asd.match_type = V4L2_ASYNC_MATCH_I2C; | 2400 | pcdev->asd.match_type = V4L2_ASYNC_MATCH_I2C; |
2403 | pcdev->asd.match.i2c.adapter_id = | 2401 | pcdev->asd.match.i2c.adapter_id = |
2404 | pcdev->pdata->sensor_i2c_adapter_id; | 2402 | pcdev->pdata->sensor_i2c_adapter_id; |
2405 | pcdev->asd.match.i2c.address = pcdev->pdata->sensor_i2c_address; | 2403 | pcdev->asd.match.i2c.address = pcdev->pdata->sensor_i2c_address; |
2404 | } else if (pdev->dev.of_node) { | ||
2405 | err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd); | ||
2406 | } else { | ||
2407 | return -ENODEV; | ||
2406 | } | 2408 | } |
2407 | if (err < 0) | 2409 | if (err < 0) |
2408 | return err; | 2410 | return err; |