diff options
| author | Maheshwar Ajja <majja@codeaurora.org> | 2017-08-24 09:55:13 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-10-26 22:57:15 -0700 |
| commit | f07109b6d70b991819a2de0ff495776630fc5bc5 (patch) | |
| tree | ff810bd0aac8d4873da83b077395b8fde43f6b11 | |
| parent | 2db878d52eef51fcc49af58f35db373ba6d09335 (diff) | |
msm: vidc: Fix memory leak issue
Amend error condition to avoid memory leak issues.
CRs-Fixed: 2091851
Change-Id: Id7ee9127ba3a22857d667e854ad7bdc0510f3995
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_v4l2_vidc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c index de5a2dececdf..e81162f3c4ad 100644 --- a/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_v4l2_vidc.c @@ -456,14 +456,15 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev) struct device *dev; int nr = BASE_DEVICE_NUMBER; - core = kzalloc(sizeof(*core), GFP_KERNEL); - if (!core || !vidc_driver) { - dprintk(VIDC_ERR, - "Failed to allocate memory for device core\n"); - rc = -ENOMEM; - goto err_no_mem; + if (!vidc_driver) { + dprintk(VIDC_ERR, "Invalid vidc driver\n"); + return -EINVAL; } + core = kzalloc(sizeof(*core), GFP_KERNEL); + if (!core) + return -ENOMEM; + dev_set_drvdata(&pdev->dev, core); rc = msm_vidc_initialize_core(pdev, core); if (rc) { @@ -628,7 +629,6 @@ err_v4l2_register: err_core_init: dev_set_drvdata(&pdev->dev, NULL); kfree(core); -err_no_mem: return rc; } |
