of_get_child_by_name acquires a reference on the port node, but of_node_put is called before crtc->port is assigned. This releases the reference while crtc->port still holds the pointer for later use by drm_of_find_possible_crtcs. Fix by moving of_node_put after crtc->port assignment.
Suggested-by: Greg KH <[email protected]> Fixes: 89a565dba1a0 ("drm: kirin: Move ade drm init to kirin drm drv") Cc: [email protected] Signed-off-by: WenTao Liang <[email protected]> --- Changes in v2: - Fix patch format based on reviewer feedback --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 8a11c2df5b88..2fda894d482e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -53,8 +53,9 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, DRM_ERROR("no port node found in %pOF\n", dev->dev->of_node); return -EINVAL; } - of_node_put(port); + crtc->port = port; + of_node_put(port); ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, driver_data->crtc_funcs, NULL); -- 2.39.5 (Apple Git-154)
