Skip to contentSkip to conversation

drm/appletbdrm: Fix ref-counting on dmadev

PATCH In review Thomas Zimmermann 2 participants 4 messages Mar 7, 2025

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/appletbdrm: Fix ref-counting on dmadev

Remove the put_device() call on dmadev. The driver sets the field without getting a reference, so it shouldn't put a reference either. The dmadev field points to the regular USB device for which DRM maintains a reference internally. Hence dmadev will not become dangling during the DRM device's lifetime.

Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Cc Aditya Garg <[email protected]>
Cc Aun-Ali Zaidi <[email protected]>
---
 drivers/gpu/drm/tiny/appletbdrm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/tiny/appletbdrm.c +0 -1
index 394c8f9bd41a..4370ba22dd88 100644
@@ -805,7 +805,6 @@ static void appletbdrm_disconnect(struct usb_interface *intf)
 	struct appletbdrm_device *adev = usb_get_intfdata(intf);
 	struct drm_device *drm = &adev->drm;
 
-	put_device(adev->dmadev);
 	drm_dev_unplug(drm);
 	drm_atomic_helper_shutdown(drm);
 }
Signature · 1 line
2.48.1
#1 lore raw

Hi Thomas

Quoted 8 lines · Thomas Zimmermann

Remove the put_device() call on dmadev. The driver sets the field without getting a reference, so it shouldn't put a reference either. The dmadev field points to the regular USB device for which DRM maintains a reference internally. Hence dmadev will not become dangling during the DRM device's lifetime.

Quoted 9 lines
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Cc Aditya Garg <[email protected]>
Cc Aun-Ali Zaidi <[email protected]>

---
drivers/gpu/drm/tiny/appletbdrm.c | 1 -

1 file changed, 1 deletion(-)

Aren’t we doing the same over here:

https://lore.kernel.org/dri-devel/[email protected]/T/#u

author maintainer
#2 lore raw

Hi

Am 07.03.25 um 10:16 schrieb Aditya Garg:

Quoted 19 lines

Hi Thomas

Quoted 8 lines · Thomas Zimmermann

Remove the put_device() call on dmadev. The driver sets the field without getting a reference, so it shouldn't put a reference either. The dmadev field points to the regular USB device for which DRM maintains a reference internally. Hence dmadev will not become dangling during the DRM device's lifetime.

Quoted 9 lines
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Cc Aditya Garg <[email protected]>
Cc Aun-Ali Zaidi <[email protected]>

---
drivers/gpu/drm/tiny/appletbdrm.c | 1 -

1 file changed, 1 deletion(-)
Quoted 3 lines

Aren’t we doing the same over here:

https://lore.kernel.org/dri-devel/[email protected]/T/#u

Yeah. That series is a full rework of the dma_dev handling for all drivers. That won't make it into v6.15. The patch here is a quick fix that we can land immediately.

Best regards
Thomas

Quoted 1 line
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Acked-by
#3 lore raw
Quoted 26 lines · Thomas Zimmermann

Hi

Am 07.03.25 um 10:16 schrieb Aditya Garg:

Quoted 19 lines

Hi Thomas

Quoted 17 lines · Thomas Zimmermann

Remove the put_device() call on dmadev. The driver sets the field without getting a reference, so it shouldn't put a reference either. The dmadev field points to the regular USB device for which DRM maintains a reference internally. Hence dmadev will not become dangling during the DRM device's lifetime.

Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Cc Aditya Garg <[email protected]>
Cc Aun-Ali Zaidi <[email protected]>

---
drivers/gpu/drm/tiny/appletbdrm.c | 1 -

1 file changed, 1 deletion(-)
Quoted 5 lines
Quoted 3 lines

Aren’t we doing the same over here:

https://lore.kernel.org/dri-devel/[email protected]/T/#u

Yeah. That series is a full rework of the dma_dev handling for all drivers. That won't make it into v6.15. The patch here is a quick fix that we can land immediately.

I see.

Quoted 15 lines

Best regards
Thomas

Quoted 1 line
Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)