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@xxxxxxxx> --- drivers/gpu/drm/kmb/kmb_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c index 961ac6fb5fcf..4a7178288ecf 100644 --- a/drivers/gpu/drm/kmb/kmb_drv.c +++ b/drivers/gpu/drm/kmb/kmb_drv.c @@ -514,8 +514,10 @@ 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; } @@ -523,8 +525,10 @@ static int kmb_probe(struct platform_device *pdev) /* 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; } -- 2.33.1