Skip to content
Permalink
Browse files
drm/kmb: fix potential memleak in error branch
This patch try to fix coccicheck warning:
./drivers/gpu/drm/kmb/kmb_drv.c:519:2-8: ERROR: missing put_device; call of_find_device_by_node on line 506, but without a corresponding object release within this function.
./drivers/gpu/drm/kmb/kmb_drv.c:522:2-8: ERROR: missing put_device; call of_find_device_by_node on line 506, but without a corresponding object release within this function.
./drivers/gpu/drm/kmb/kmb_drv.c:529:2-8: ERROR: missing put_device; call of_find_device_by_node on line 506, but without a corresponding object release within this function.
./drivers/gpu/drm/kmb/kmb_drv.c:579:1-7: ERROR: missing put_device; call of_find_device_by_node on line 506, but without a corresponding object release within this function.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
  • Loading branch information
Bernard Zhao authored and intel-lab-lkp committed Nov 18, 2021
1 parent b6c2472 commit bbd8ae6a806e8e9e31c362a76ab4ba02a43b4694
Showing 1 changed file with 7 additions and 1 deletion.
@@ -514,17 +514,21 @@ static int kmb_probe(struct platform_device *pdev)
ret = kmb_dsi_host_bridge_init(get_device(&dsi_pdev->dev));

if (ret == -EPROBE_DEFER) {
of_dev_put(dsi_pdev);
return -EPROBE_DEFER;
} else if (ret) {
of_dev_put(dsi_pdev);
DRM_ERROR("probe failed to initialize DSI host bridge\n");
return ret;
}

/* Create DRM device */
kmb = devm_drm_dev_alloc(dev, &kmb_driver,
struct kmb_drm_private, drm);
if (IS_ERR(kmb))
if (IS_ERR(kmb)) {
of_dev_put(dsi_pdev);
return PTR_ERR(kmb);
}

dev_set_drvdata(dev, &kmb->drm);

@@ -572,6 +576,8 @@ static int kmb_probe(struct platform_device *pdev)
dev_set_drvdata(dev, NULL);
kmb_dsi_host_unregister(kmb->kmb_dsi);

of_dev_put(dsi_pdev);

return ret;
}

0 comments on commit bbd8ae6

Please sign in to comment.