Merge "msm: vidc: Fix memory leak issue"

This commit is contained in:
Linux Build Service Account 2017-11-23 14:01:19 -08:00 committed by Gerrit - the friendly Code Review server
commit af5f70355c

View file

@ -456,14 +456,15 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
struct device *dev; struct device *dev;
int nr = BASE_DEVICE_NUMBER; int nr = BASE_DEVICE_NUMBER;
core = kzalloc(sizeof(*core), GFP_KERNEL); if (!vidc_driver) {
if (!core || !vidc_driver) { dprintk(VIDC_ERR, "Invalid vidc driver\n");
dprintk(VIDC_ERR, return -EINVAL;
"Failed to allocate memory for device core\n");
rc = -ENOMEM;
goto err_no_mem;
} }
core = kzalloc(sizeof(*core), GFP_KERNEL);
if (!core)
return -ENOMEM;
dev_set_drvdata(&pdev->dev, core); dev_set_drvdata(&pdev->dev, core);
rc = msm_vidc_initialize_core(pdev, core); rc = msm_vidc_initialize_core(pdev, core);
if (rc) { if (rc) {
@ -628,7 +629,6 @@ err_v4l2_register:
err_core_init: err_core_init:
dev_set_drvdata(&pdev->dev, NULL); dev_set_drvdata(&pdev->dev, NULL);
kfree(core); kfree(core);
err_no_mem:
return rc; return rc;
} }