[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211118023723.85553-1-bernard@vivo.com>
Date: Wed, 17 Nov 2021 18:37:23 -0800
From: Bernard Zhao <bernard@...o.com>
To: Anitha Chrisanthus <anitha.chrisanthus@...el.com>,
Edmund Dea <edmund.j.dea@...el.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: Bernard Zhao <bernard@...o.com>
Subject: [PATCH] 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@...o.com>
---
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
Powered by blists - more mailing lists