deinterlace: deinterlace: fix coverity error [1/1]
authorJihong Sui <jihong.sui@amlogic.com>
Tue, 4 Dec 2018 09:51:39 +0000 (17:51 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 6 Dec 2018 10:54:52 +0000 (02:54 -0800)
PD#SWPL-2863

Problem:
cdev_add without checking return value.

Solution:
add check

Verify:
p212

Change-Id: Ib1d96f6e5ee07dd28f67eb4ee77acb6580a1f877
Signed-off-by: Jihong Sui <jihong.sui@amlogic.com>
drivers/amlogic/media/deinterlace/deinterlace.c

index ea065af..626d3d3 100644 (file)
@@ -7497,7 +7497,10 @@ static int di_probe(struct platform_device *pdev)
        di_devp->flags |= DI_SUSPEND_FLAG;
        cdev_init(&(di_devp->cdev), &di_fops);
        di_devp->cdev.owner = THIS_MODULE;
-       cdev_add(&(di_devp->cdev), di_devno, DI_COUNT);
+       ret = cdev_add(&(di_devp->cdev), di_devno, DI_COUNT);
+       if (ret)
+               goto fail_cdev_add;
+
        di_devp->devt = MKDEV(MAJOR(di_devno), 0);
        di_devp->dev = device_create(di_clsp, &pdev->dev,
                di_devp->devt, di_devp, "di%d", 0);
@@ -7648,6 +7651,14 @@ static int di_probe(struct platform_device *pdev)
                pr_err("%s create kthread error.\n", __func__);
        di_debugfs_init();      /*2018-07-18 add debugfs*/
        di_patch_post_update_mc_sw(DI_MC_SW_IC, true);
+
+       pr_info("%s:ok\n", __func__);
+       return ret;
+
+fail_cdev_add:
+       pr_info("%s:fail_cdev_add\n", __func__);
+       kfree(di_devp);
+
 fail_kmalloc_dev:
        return ret;
 }