drm/tilcdc: Fix removal actions in case of failed probe
Subsystems (4)
PATCH v4 1/1 drm/tilcdc: Fix removal actions in case of failed probe
From: "Kory Maincent (TI.com)" <[email protected]>
The drm_kms_helper_poll_fini() and drm_atomic_helper_shutdown() helpers should only be called when the device has been successfully registered. Currently, these functions are called unconditionally in tilcdc_fini(), which causes warnings during probe deferral scenarios.
[ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
Fix this by rewriting the failed probe cleanup path using the standard goto error handling pattern, which ensures that cleanup functions are only called on successfully initialized resources. Additionally, remove the now-unnecessary is_registered flag.
---
I'm working on removing the usage of deprecated functions as well as general improvements to this driver, but it will take some time so for now this is a simple fix to a functional bug.
Change in v4:
- Fix an unused label warning reported by the kernel test robot.
Change in v3:
- Rewrite the failed probe clean up path using goto
- Remove the is_registered flag
Change in v2:
- Add missing cc: stable tag
- Add Swamil reviewed-by
--- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 53 ++++++++++++++++++---------- drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 +- 3 files changed, 37 insertions(+), 20 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +1 -1
@@ -586,7 +586,7 @@ static void tilcdc_crtc_recover_work(struct work_struct *work)drm_modeset_unlock (&crtc->mutex); } -static void tilcdc_crtc_destroy (struct drm_crtc *crtc) +void tilcdc_crtc_destroy (struct drm_crtc *crtc) {struct tilcdc_drm_private *priv = crtc->dev->dev_private;
drivers/gpu/drm/tilcdc/tilcdc_drv.c +35 -18
133 lines not on this page · raw message
drivers/gpu/drm/tilcdc/tilcdc_drv.h +1 -1
@@ -82,7 +82,6 @@ struct tilcdc_drm_private {struct drm_encoder *external_encoder;struct drm_connector *external_connector; -bool is_registered;bool is_componentized;bool irq_enabled; };
@@ -164,6 +163,7 @@ void tilcdc_crtc_set_panel_info(struct drm_crtc *crtc,void tilcdc_crtc_set_simulate_vesa_sync (struct drm_crtc *crtc,bool simulate_vesa_sync);void tilcdc_crtc_shutdown (struct drm_crtc *crtc); +void tilcdc_crtc_destroy (struct drm_crtc *crtc);int tilcdc_crtc_update_fb (struct drm_crtc *crtc,struct drm_framebuffer *fb,struct drm_pending_vblank_event *event);
Signature · 1 line
2.43.0
Quoted 15 lines · Kory Maincent
From: "Kory Maincent (TI.com)" <[email protected]>
The
drm_kms_helper_poll_fini()anddrm_atomic_helper_shutdown()helpers should only be called when the device has been successfully registered. Currently, these functions are called unconditionally intilcdc_fini(), which causes warnings during probe deferral scenarios.[ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]
Quoted 8 lines
Fix this by rewriting the failed probe cleanup path using the standard goto error handling pattern, which ensures that cleanup functions are only called on successfully initialized resources. Additionally, remove the now-unnecessary
is_registeredflag.Fixes 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")Signed-off-by Kory Maincent (TI.com) <[email protected]>
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Hi,
Quoted 37 lines · Kory Maincent
From: "Kory Maincent (TI.com)" <[email protected]>
The
drm_kms_helper_poll_fini()anddrm_atomic_helper_shutdown()helpers should only be called when the device has been successfully registered. Currently, these functions are called unconditionally intilcdc_fini(), which causes warnings during probe deferral scenarios.[ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]Fix this by rewriting the failed probe cleanup path using the standard goto error handling pattern, which ensures that cleanup functions are only called on successfully initialized resources. Additionally, remove the now-unnecessary
is_registeredflag.Fixes 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")Signed-off-by Kory Maincent (TI.com) <[email protected]>---
I'm working on removing the usage of deprecated functions as well as general improvements to this driver, but it will take some time so for now this is a simple fix to a functional bug.
Change in v4:
- Fix an unused label warning reported by the kernel test robot.Change in v3:
- Rewrite the failed probe clean up path using goto
- Remove theis_registeredflag
Quoted 8 lines
Change in v2:
- Add missing cc: stable tag
- Add Swamil reviewed-by--- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 53 ++++++++++++++++++---------- drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 +- 3 files changed, 37 insertions(+), 20 deletions(-)
Seems reasonable to me. I did a once-over and based on code inspection it looks like things are being reversed properly. I agree this should probably land to fix the regression while waiting for a bigger cleanup.
This fixup has been sitting out there for a while. Who is the right person to apply it? If nobody else does and there are no objections, I can apply it to "fixes" next week...
-Doug
Doug Anderson
AppliedHi,
Quoted 55 lines · Doug Anderson
Hi,
Quoted 37 lines · Kory Maincent
From: "Kory Maincent (TI.com)" <[email protected]>
The
drm_kms_helper_poll_fini()anddrm_atomic_helper_shutdown()helpers should only be called when the device has been successfully registered. Currently, these functions are called unconditionally intilcdc_fini(), which causes warnings during probe deferral scenarios.[ 7.972317] WARNING: CPU: 0 PID: 23 at drivers/gpu/drm/drm_atomic_state_helper.c:175 drm_atomic_helper_crtc_duplicate_state+0x60/0x68 ... [ 8.005820] drm_atomic_helper_crtc_duplicate_state from drm_atomic_get_crtc_state+0x68/0x108 [ 8.005858] drm_atomic_get_crtc_state from drm_atomic_helper_disable_all+0x90/0x1c8 [ 8.005885] drm_atomic_helper_disable_all from drm_atomic_helper_shutdown+0x90/0x144 [ 8.005911] drm_atomic_helper_shutdown from tilcdc_fini+0x68/0xf8 [tilcdc] [ 8.005957] tilcdc_fini [tilcdc] from tilcdc_pdev_probe+0xb0/0x6d4 [tilcdc]Fix this by rewriting the failed probe cleanup path using the standard goto error handling pattern, which ensures that cleanup functions are only called on successfully initialized resources. Additionally, remove the now-unnecessary
is_registeredflag.Fixes 3c4babae3c4a ("drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers")Signed-off-by Kory Maincent (TI.com) <[email protected]>---
I'm working on removing the usage of deprecated functions as well as general improvements to this driver, but it will take some time so for now this is a simple fix to a functional bug.
Change in v4:
- Fix an unused label warning reported by the kernel test robot.Change in v3:
- Rewrite the failed probe clean up path using goto
- Remove theis_registeredflagQuoted 8 lines
Change in v2:
- Add missing cc: stable tag
- Add Swamil reviewed-by--- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 53 ++++++++++++++++++---------- drivers/gpu/drm/tilcdc/tilcdc_drv.h | 2 +- 3 files changed, 37 insertions(+), 20 deletions(-)Seems reasonable to me. I did a once-over and based on code inspection it looks like things are being reversed properly. I agree this should probably land to fix the regression while waiting for a bigger cleanup.
Quoted 5 lines
Reviewed-by Douglas Anderson <[email protected]>This fixup has been sitting out there for a while. Who is the right person to apply it? If nobody else does and there are no objections, I can apply it to "fixes" next week...
Pushed to drm-misc-fixes:
[1/1] drm/tilcdc: Fix removal actions in case of failed probe
commit: a585c7ef9cabda58088916baedc6573e9a5cd2a7