[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c4137f43453ee9ae17592dd230426f26e338f0d8.camel@mediatek.com>
Date: Wed, 10 Sep 2025 01:38:12 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>, "johan@...nel.org"
<johan@...nel.org>
CC: "simona@...ll.ch" <simona@...ll.ch>, "make24@...as.ac.cn"
<make24@...as.ac.cn>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, "airlied@...il.com"
<airlied@...il.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH 2/2] drm/mediatek: clean up driver data initialisation
On Fri, 2025-08-29 at 11:03 +0200, Johan Hovold wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> The platform and drm devices are only used to look up the drm device and
> its driver data respectively when initialising the driver data during
> bind().
>
> Drop the reference counts as soon as they have been used to make the
> code more readable.
>
> Note that the crtc count is never incremented on lookup failures.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Signed-off-by: Johan Hovold <johan@...nel.org>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 3b02ed0a16da..33b83576af7e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -395,12 +395,14 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
> continue;
>
> drm_dev = device_find_child(&pdev->dev, NULL, mtk_drm_match);
> + put_device(&pdev->dev);
> if (!drm_dev)
> - goto next_put_device_pdev_dev;
> + continue;
>
> temp_drm_priv = dev_get_drvdata(drm_dev);
> + put_device(drm_dev);
> if (!temp_drm_priv)
> - goto next_put_device_drm_dev;
> + continue;
>
> if (temp_drm_priv->data->main_len)
> all_drm_priv[CRTC_MAIN] = temp_drm_priv;
> @@ -412,12 +414,6 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
> if (temp_drm_priv->mtk_drm_bound)
> cnt++;
>
> -next_put_device_drm_dev:
> - put_device(drm_dev);
> -
> -next_put_device_pdev_dev:
> - put_device(&pdev->dev);
> -
> if (cnt == MAX_CRTC) {
> of_node_put(node);
> break;
> --
> 2.49.1
>
Powered by blists - more mailing lists