[media] vpfe_capture: fix compiler warning
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 21 Nov 2016 13:59:20 +0000 (11:59 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 22 Nov 2016 10:13:24 +0000 (08:13 -0200)
davinci/vpfe_capture.c: In function 'vpfe_probe':
davinci/vpfe_capture.c:1992:9: warning: 'ret' may be used uninitialized
in this function [-Wmaybe-uninitialized]
   return ret;
          ^~~

This is indeed correct, so if the kmalloc fails set ret to -ENOMEM.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/davinci/vpfe_capture.c

index 6c41782b3ba089ee3344fc5fff40a11c05c4f9b4..bc2c62b95493c3d368ae8fde9ed4fe9c13a74ae6 100644 (file)
@@ -1847,8 +1847,10 @@ static int vpfe_probe(struct platform_device *pdev)
 
        /* Allocate memory for ccdc configuration */
        ccdc_cfg = kmalloc(sizeof(*ccdc_cfg), GFP_KERNEL);
-       if (!ccdc_cfg)
+       if (!ccdc_cfg) {
+               ret = -ENOMEM;
                goto probe_free_dev_mem;
+       }
 
        mutex_lock(&ccdc_lock);