[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211025015550.66500-1-heying24@huawei.com>
Date: Sun, 24 Oct 2021 21:55:50 -0400
From: He Ying <heying24@...wei.com>
To: <hjc@...k-chips.com>, <heiko@...ech.de>, <airlied@...ux.ie>,
<daniel@...ll.ch>, <seanpaul@...omium.org>,
<gustavo.padovan@...labora.com>
CC: <dri-devel@...ts.freedesktop.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-rockchip@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] drm: Fix wrong use of connector in vop_get_edp_connector
>From the comments of drm_for_each_connector_iter(), we know
that "connector is only valid within the list body, if you
want to use connector after calling drm_connector_list_iter_end()
then you need to grab your own reference first using
drm_connector_get()". So fix the wrong use of connector
according to the comments and then call drm_connector_put()
after using connector finishes.
Signed-off-by: He Ying <heying24@...wei.com>
Fixes: 2cbeb64f6c70 ("drm/rockchip: use drm_for_each_connector_iter()")
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index a25b98b7f5bd..469922ad29fa 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1581,19 +1581,19 @@ static void vop_crtc_reset(struct drm_crtc *crtc)
#ifdef CONFIG_DRM_ANALOGIX_DP
static struct drm_connector *vop_get_edp_connector(struct vop *vop)
{
- struct drm_connector *connector;
+ struct drm_connector *connector = NULL;
struct drm_connector_list_iter conn_iter;
drm_connector_list_iter_begin(vop->drm_dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter) {
if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
- drm_connector_list_iter_end(&conn_iter);
- return connector;
+ drm_connector_get(connector);
+ break;
}
}
drm_connector_list_iter_end(&conn_iter);
- return NULL;
+ return connector;
}
static int vop_crtc_set_crc_source(struct drm_crtc *crtc,
@@ -1614,6 +1614,7 @@ static int vop_crtc_set_crc_source(struct drm_crtc *crtc,
else
ret = -EINVAL;
+ drm_connector_put(connector);
return ret;
}
--
2.17.1
Powered by blists - more mailing lists