From 1b8354dfbbdf70d75b35a44e89de377c8730206a Mon Sep 17 00:00:00 2001 From: Jihong Sui Date: Tue, 4 Dec 2018 17:51:39 +0800 Subject: [PATCH] deinterlace: deinterlace: fix coverity error [1/1] PD#SWPL-2863 Problem: cdev_add without checking return value. Solution: add check Verify: p212 Change-Id: Ib1d96f6e5ee07dd28f67eb4ee77acb6580a1f877 Signed-off-by: Jihong Sui --- drivers/amlogic/media/deinterlace/deinterlace.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/media/deinterlace/deinterlace.c b/drivers/amlogic/media/deinterlace/deinterlace.c index ea065af43298..626d3d3a7985 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.c +++ b/drivers/amlogic/media/deinterlace/deinterlace.c @@ -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; } -- 2.20.1