The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] drm/loongson: use managed KMS polling
@ 2026-05-12  6:36 Myeonghun Pak
  2026-05-12  6:40 ` Thomas Zimmermann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Myeonghun Pak @ 2026-05-12  6:36 UTC (permalink / raw)
  To: dri-devel
  Cc: Myeonghun Pak, Icenowy Zheng, Thomas Zimmermann, Sui Jingfeng,
	Jianmin Lv, Qianhai Wu, Huacai Chen, Mingcong Bai, Xi Ruoyao,
	Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
	linux-kernel, stable, Ijae Kim

lsdc_pci_probe() initializes KMS polling before setting up vblank support,
requesting the IRQ and registering the DRM device. If any of those later
steps fails, probe returns without finalizing polling. The driver also
never finalizes polling on regular removal.

Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
lifetime and automatically finalized on probe failure and device removal.

This issue was identified during our ongoing static-analysis research while
reviewing kernel code.

Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Changes in v2:
- Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
  and Thomas Zimmermann instead of adding manual cleanup paths.

 drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index abf5bf68ee..4b97750897 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	vga_client_register(pdev, lsdc_vga_set_decode);
 
-	drm_kms_helper_poll_init(ddev);
+	drmm_kms_helper_poll_init(ddev);
 
 	if (loongson_vblank) {
 		ret = drm_vblank_init(ddev, descp->num_of_crtc);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/loongson: use managed KMS polling
  2026-05-12  6:36 Myeonghun Pak
@ 2026-05-12  6:40 ` Thomas Zimmermann
  2026-05-12  7:55 ` Jianmin Lv
  2026-05-12  8:11 ` Huacai Chen
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2026-05-12  6:40 UTC (permalink / raw)
  To: Myeonghun Pak, dri-devel
  Cc: Icenowy Zheng, Sui Jingfeng, Jianmin Lv, Qianhai Wu, Huacai Chen,
	Mingcong Bai, Xi Ruoyao, Maarten Lankhorst, Maxime Ripard,
	David Airlie, Simona Vetter, linux-kernel, stable, Ijae Kim



Am 12.05.26 um 08:36 schrieb Myeonghun Pak:
> lsdc_pci_probe() initializes KMS polling before setting up vblank support,
> requesting the IRQ and registering the DRM device. If any of those later
> steps fails, probe returns without finalizing polling. The driver also
> never finalizes polling on regular removal.
>
> Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
> lifetime and automatically finalized on probe failure and device removal.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
>
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
> Changes in v2:
> - Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
>    and Thomas Zimmermann instead of adding manual cleanup paths.
>
>   drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index abf5bf68ee..4b97750897 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   
>   	vga_client_register(pdev, lsdc_vga_set_decode);
>   
> -	drm_kms_helper_poll_init(ddev);
> +	drmm_kms_helper_poll_init(ddev);
>   
>   	if (loongson_vblank) {
>   		ret = drm_vblank_init(ddev, descp->num_of_crtc);

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] drm/loongson: use managed KMS polling
@ 2026-05-12  6:53 Myeonghun Pak
  2026-05-12  6:56 ` Myeonghun Pak
  0 siblings, 1 reply; 7+ messages in thread
From: Myeonghun Pak @ 2026-05-12  6:53 UTC (permalink / raw)
  To: Tobias Klauser, Greg Kroah-Hartman, Jiri Slaby, dri-devel
  Cc: Myeonghun Pak, Icenowy Zheng, Thomas Zimmermann, Sui Jingfeng,
	Jianmin Lv, Qianhai Wu, Huacai Chen, Mingcong Bai, Xi Ruoyao,
	Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
	linux-kernel, stable, Ijae Kim

lsdc_pci_probe() initializes KMS polling before setting up vblank support,
requesting the IRQ and registering the DRM device. If any of those later
steps fails, probe returns without finalizing polling. The driver also
never finalizes polling on regular removal.

Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
lifetime and automatically finalized on probe failure and device removal.

This issue was identified during our ongoing static-analysis research while
reviewing kernel code.

Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Changes in v2:
- Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
  and Thomas Zimmermann instead of adding manual cleanup paths.

 drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index abf5bf68ee..4b97750897 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	vga_client_register(pdev, lsdc_vga_set_decode);
 
-	drm_kms_helper_poll_init(ddev);
+	drmm_kms_helper_poll_init(ddev);
 
 	if (loongson_vblank) {
 		ret = drm_vblank_init(ddev, descp->num_of_crtc);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/loongson: use managed KMS polling
  2026-05-12  6:53 [PATCH v2] drm/loongson: use managed KMS polling Myeonghun Pak
@ 2026-05-12  6:56 ` Myeonghun Pak
  0 siblings, 0 replies; 7+ messages in thread
From: Myeonghun Pak @ 2026-05-12  6:56 UTC (permalink / raw)
  To: Tobias Klauser, Greg Kroah-Hartman, Jiri Slaby, dri-devel
  Cc: Icenowy Zheng, Thomas Zimmermann, Sui Jingfeng, Jianmin Lv,
	Qianhai Wu, Huacai Chen, Mingcong Bai, Xi Ruoyao,
	Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
	linux-kernel, stable, Ijae Kim

Hi,

Sorry, I accidentally sent a duplicate copy of this patch. Please ignore
this one.

Thanks,
Myeonghun


2026년 5월 12일 (화) 오후 3:54, Myeonghun Pak <mhun512@gmail.com>님이 작성:
>
> lsdc_pci_probe() initializes KMS polling before setting up vblank support,
> requesting the IRQ and registering the DRM device. If any of those later
> steps fails, probe returns without finalizing polling. The driver also
> never finalizes polling on regular removal.
>
> Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
> lifetime and automatically finalized on probe failure and device removal.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
>
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
> Changes in v2:
> - Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
>   and Thomas Zimmermann instead of adding manual cleanup paths.
>
>  drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index abf5bf68ee..4b97750897 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>
>         vga_client_register(pdev, lsdc_vga_set_decode);
>
> -       drm_kms_helper_poll_init(ddev);
> +       drmm_kms_helper_poll_init(ddev);
>
>         if (loongson_vblank) {
>                 ret = drm_vblank_init(ddev, descp->num_of_crtc);
> --
> 2.47.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/loongson: use managed KMS polling
  2026-05-12  6:36 Myeonghun Pak
  2026-05-12  6:40 ` Thomas Zimmermann
@ 2026-05-12  7:55 ` Jianmin Lv
  2026-05-12  8:11 ` Huacai Chen
  2 siblings, 0 replies; 7+ messages in thread
From: Jianmin Lv @ 2026-05-12  7:55 UTC (permalink / raw)
  To: Myeonghun Pak, dri-devel
  Cc: Icenowy Zheng, Thomas Zimmermann, Qianhai Wu, Huacai Chen,
	Mingcong Bai, Xi Ruoyao, Maarten Lankhorst, Maxime Ripard,
	David Airlie, Simona Vetter, linux-kernel, stable, Ijae Kim



On 2026/5/12 下午2:36, Myeonghun Pak wrote:
> lsdc_pci_probe() initializes KMS polling before setting up vblank support,
> requesting the IRQ and registering the DRM device. If any of those later
> steps fails, probe returns without finalizing polling. The driver also
> never finalizes polling on regular removal.
> 
> Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
> lifetime and automatically finalized on probe failure and device removal.
> 
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
> 
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Acked-by: Jianmin Lv <lvjianmin@loongson.cn>

> ---
> Changes in v2:
> - Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
>    and Thomas Zimmermann instead of adding manual cleanup paths.
> 
>   drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index abf5bf68ee..4b97750897 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   
>   	vga_client_register(pdev, lsdc_vga_set_decode);
>   
> -	drm_kms_helper_poll_init(ddev);
> +	drmm_kms_helper_poll_init(ddev);
>   
>   	if (loongson_vblank) {
>   		ret = drm_vblank_init(ddev, descp->num_of_crtc);
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/loongson: use managed KMS polling
  2026-05-12  6:36 Myeonghun Pak
  2026-05-12  6:40 ` Thomas Zimmermann
  2026-05-12  7:55 ` Jianmin Lv
@ 2026-05-12  8:11 ` Huacai Chen
  2026-05-13  6:56   ` Myeonghun Pak
  2 siblings, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2026-05-12  8:11 UTC (permalink / raw)
  To: Myeonghun Pak
  Cc: dri-devel, Icenowy Zheng, Thomas Zimmermann, Sui Jingfeng,
	Jianmin Lv, Qianhai Wu, Mingcong Bai, Xi Ruoyao,
	Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
	linux-kernel, stable, Ijae Kim

On Tue, May 12, 2026 at 2:37 PM Myeonghun Pak <mhun512@gmail.com> wrote:
>
> lsdc_pci_probe() initializes KMS polling before setting up vblank support,
> requesting the IRQ and registering the DRM device. If any of those later
> steps fails, probe returns without finalizing polling. The driver also
> never finalizes polling on regular removal.
>
> Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
> lifetime and automatically finalized on probe failure and device removal.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
In the subject line please s/use/Use/g, others LGTM.
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>

>
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
> Changes in v2:
> - Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
>   and Thomas Zimmermann instead of adding manual cleanup paths.
>
>  drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index abf5bf68ee..4b97750897 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>
>         vga_client_register(pdev, lsdc_vga_set_decode);
>
> -       drm_kms_helper_poll_init(ddev);
> +       drmm_kms_helper_poll_init(ddev);
>
>         if (loongson_vblank) {
>                 ret = drm_vblank_init(ddev, descp->num_of_crtc);
> --
> 2.47.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/loongson: use managed KMS polling
  2026-05-12  8:11 ` Huacai Chen
@ 2026-05-13  6:56   ` Myeonghun Pak
  0 siblings, 0 replies; 7+ messages in thread
From: Myeonghun Pak @ 2026-05-13  6:56 UTC (permalink / raw)
  To: Huacai Chen
  Cc: dri-devel, Icenowy Zheng, Thomas Zimmermann, Sui Jingfeng,
	Jianmin Lv, Qianhai Wu, Mingcong Bai, Xi Ruoyao,
	Maarten Lankhorst, Maxime Ripard, David Airlie, Simona Vetter,
	linux-kernel, stable, Ijae Kim

Hi Huacai,

Thanks, I sent a v3 with the subject fixed and added the Reviewed-by and
Acked-by tags.

Best regards,
Myeonghun

2026년 5월 12일 (화) 오후 5:11, Huacai Chen <chenhuacai@kernel.org>님이 작성:
>
> On Tue, May 12, 2026 at 2:37 PM Myeonghun Pak <mhun512@gmail.com> wrote:
> >
> > lsdc_pci_probe() initializes KMS polling before setting up vblank support,
> > requesting the IRQ and registering the DRM device. If any of those later
> > steps fails, probe returns without finalizing polling. The driver also
> > never finalizes polling on regular removal.
> >
> > Use drmm_kms_helper_poll_init() so polling is tied to the DRM device
> > lifetime and automatically finalized on probe failure and device removal.
> >
> > This issue was identified during our ongoing static-analysis research while
> > reviewing kernel code.
> In the subject line please s/use/Use/g, others LGTM.
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
>
> >
> > Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> > Cc: stable@vger.kernel.org
> > Co-developed-by: Ijae Kim <ae878000@gmail.com>
> > Signed-off-by: Ijae Kim <ae878000@gmail.com>
> > Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> > ---
> > Changes in v2:
> > - Switch to drmm_kms_helper_poll_init() as suggested by Icenowy Zheng
> >   and Thomas Zimmermann instead of adding manual cleanup paths.
> >
> >  drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> > index abf5bf68ee..4b97750897 100644
> > --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> > +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> > @@ -292,7 +292,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> >
> >         vga_client_register(pdev, lsdc_vga_set_decode);
> >
> > -       drm_kms_helper_poll_init(ddev);
> > +       drmm_kms_helper_poll_init(ddev);
> >
> >         if (loongson_vblank) {
> >                 ret = drm_vblank_init(ddev, descp->num_of_crtc);
> > --
> > 2.47.1
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-13  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  6:53 [PATCH v2] drm/loongson: use managed KMS polling Myeonghun Pak
2026-05-12  6:56 ` Myeonghun Pak
  -- strict thread matches above, loose matches on Subject: below --
2026-05-12  6:36 Myeonghun Pak
2026-05-12  6:40 ` Thomas Zimmermann
2026-05-12  7:55 ` Jianmin Lv
2026-05-12  8:11 ` Huacai Chen
2026-05-13  6:56   ` Myeonghun Pak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox