Skip to contentSkip to conversation

drm/loongson: use managed KMS polling

PATCH Superseded Myeonghun Pak 4 participants 5 messages May 12 – May 13

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/loongson: use managed KMS polling

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")

---
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(-)
drivers/gpu/drm/loongson/lsdc_drv.c +1 -1
index abf5bf68ee..4b97750897 100644
@@ -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);
Signature · 1 line
2.47.1
maintainer Reviewed-by on v2 1/1
#1 lore raw

Am 12.05.26 um 08:36 schrieb Myeonghun Pak:

Quoted 8 lines

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.

Quoted 8 lines

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

Fixes f39db26c5428 ("drm: Add kms driver for loongson display controller")
Quoted 21 lines

---
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(-)
drivers/gpu/drm/loongson/lsdc_drv.c +1 -1
index abf5bf68ee..4b97750897 100644
@@ -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);
Signature · 6 lines
--
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)
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Myeonghun Pak
Quoted 8 lines · 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.

Quoted 8 lines

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

Fixes f39db26c5428 ("drm: Add kms driver for loongson display controller")
Quoted 22 lines

---
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(-)
drivers/gpu/drm/loongson/lsdc_drv.c +1 -1
index abf5bf68ee..4b97750897 100644
@@ -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);
reviewer Reviewed-by on v2 1/1
#3 lore raw
In reply to Myeonghun Pak
Quoted 11 lines · 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.

In the subject line please s/use/Use/g, others LGTM.

Quoted 30 lines
Fixes f39db26c5428 ("drm: Add kms driver for loongson display controller")

---
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(-)
drivers/gpu/drm/loongson/lsdc_drv.c +1 -2
index abf5bf68ee..4b97750897 100644
@@ -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

#4 lore raw

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 <[email protected]>님이 작성:

Quoted 46 lines · Myeonghun Pak
Quoted 11 lines

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.

Quoted 30 lines
Fixes f39db26c5428 ("drm: Add kms driver for loongson display controller")

---
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(-)
drivers/gpu/drm/loongson/lsdc_drv.c +1 -2
index abf5bf68ee..4b97750897 100644
@@ -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