[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <60f07638-aca2-a1c5-c80e-c5ea4de6b223@huawei.com>
Date: Tue, 9 Nov 2021 10:06:07 +0800
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: Re: [PATCH] drm: Fix wrong use of connector in vop_get_edp_connector
kindly ping...
在 2021/10/25 9:55, He Ying 写道:
> >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;
> }
>
Powered by blists - more mailing lists