public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: yaolu@kylinos.cn, markus.elfring@web.de
Cc: chenhuacai@kernel.org, dri-devel@lists.freedesktop.org,
	jeffbai@aosc.io, linux-kernel@vger.kernel.org,
	lvjianmin@loongson.cn, wuqianhai@loongson.cn,
		zhengxingda@iscas.ac.cn
Subject: Re: [PATCH v2] drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram()
Date: Wed, 20 May 2026 17:11:26 +0800	[thread overview]
Message-ID: <788292607f1d81531f27b6fb616debc2d0ec1da1.camel@xry111.site> (raw)
In-Reply-To: <20260520014721.32696-1-yaolu@kylinos.cn>

On Wed, 2026-05-20 at 09:47 +0800, yaolu@kylinos.cn wrote:
> From: Lu Yao <yaolu@kylinos.cn>
> 
> Need to call pci_dev_put() after pci_get_domain_bus_and_slot().
> 
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Signed-off-by: Lu Yao <yaolu@kylinos.cn>
> ---
> v1->v2: add fixes tag and parentheses to function names suggested by
> Markus.
>   Link: https://lore.kernel.org/dri-devel/8ba844ab-9851-4045-a4e8-a96e6d1511e2@web.de/#R
> 
>  drivers/gpu/drm/loongson/lsdc_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> 
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 34405073c4d4..6cd21480c979 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -183,6 +183,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
>  	ldev->vram_size = size;
>  	ldev->gpu = pdev_gpu;
>  
> +	pci_dev_put(pdev_gpu);

It looks suspicious as pci_dev_put will immediately invalidate pdev_gpu
that we just assigned to ldev->gpu.

>From what I can tell it seems nobody is using that value though.  IMO we
should remove the assignment and also drop the gpu field in struct
lsdc_device.


-- 
Xi Ruoyao <xry111@xry111.site>

  parent reply	other threads:[~2026-05-21  6:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  7:38 [PATH] drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram yaolu
2026-05-19  8:00 ` Markus Elfring
2026-05-20  1:47   ` [PATCH v2] drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram() yaolu
2026-05-20  9:05     ` Markus Elfring
2026-05-20  9:11     ` Xi Ruoyao [this message]
2026-05-20 12:05       ` [PATCH v3] drm/loongson: rm unused member lsdc_device->gpu yaolu
2026-05-20 13:19         ` Markus Elfring
2026-05-25 11:54     ` Claude review: drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram() Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=788292607f1d81531f27b6fb616debc2d0ec1da1.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenhuacai@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jeffbai@aosc.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvjianmin@loongson.cn \
    --cc=markus.elfring@web.de \
    --cc=wuqianhai@loongson.cn \
    --cc=yaolu@kylinos.cn \
    --cc=zhengxingda@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox