We have to check the pointer before dereferencing it.

Signed-off-by: Andy Shevchenko <andy.shevche...@gmail.com>
---
 drivers/media/platform/soc_camera/soc_camera.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index b3db51c..8c665c4 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -2166,7 +2166,7 @@ static int soc_camera_video_start(struct 
soc_camera_device *icd)
 static int soc_camera_pdrv_probe(struct platform_device *pdev)
 {
        struct soc_camera_desc *sdesc = pdev->dev.platform_data;
-       struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc;
+       struct soc_camera_subdev_desc *ssdd;
        struct soc_camera_device *icd;
        int ret;
 
@@ -2177,6 +2177,8 @@ static int soc_camera_pdrv_probe(struct platform_device 
*pdev)
        if (!icd)
                return -ENOMEM;
 
+       ssdd = &sdesc->subdev_desc;
+
        /*
         * In the asynchronous case ssdd->num_regulators == 0 yet, so, the below
         * regulator allocation is a dummy. They are actually requested by the
-- 
1.8.3.101.g727a46b

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to