drm/logicvc: keep the IRQ within the display resource lifetime
Subsystems (3)
PATCH 1/1 drm/logicvc: keep the IRQ within the display resource lifetime
The managed IRQ is requested before the managed CRTC allocation. Probe unwind can therefore free the CRTC while the handler remains installed. Probe errors and remove also disable clocks before devres frees the IRQ.
Request the IRQ after display and vblank initialization. Release it on registration failure and removal before disabling the clocks. Keep it installed through atomic shutdown so pending commits can still receive vblank completion.
This issue was found by static analysis.
Fixes efeeaefe9be5 ("drm: Add support for the LogiCVC display controller")
Assisted-by LLM
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
---
Compile-tested with Clang, W=1 (x86_64): logicvc_drm.o and logicvc_crtc.o. No runtime or hardware testing.
drivers/gpu/drm/logicvc/logicvc_drm.c | 21 +++++++++++++-------- drivers/gpu/drm/logicvc/logicvc_drm.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/logicvc/logicvc_drm.c +13 -8
@@ -366,6 +366,7 @@ static int logicvc_drm_probe(struct platform_device *pdev) drm_dev = &logicvc->drm_dev; logicvc->regmap = regmap; + logicvc->irq = irq;INIT_LIST_HEAD (&logicvc->layers_list); caps =logicvc_drm_caps_match (logicvc);
@@ -385,13 +386,6 @@ static int logicvc_drm_probe(struct platform_device *pdev) goto error_reserved_mem; } - ret =devm_request_irq (dev, irq, logicvc_drm_irq_handler,0 , -dev_name (dev), logicvc); -if (ret) { -drm_err (drm_dev,"Failed to request IRQ\n" ); - goto error_clocks; - } - ret =logicvc_drm_config_parse (logicvc);if (ret && ret != -ENODEV ) {drm_err (drm_dev,"Failed to parse config\n" );
@@ -434,16 +428,26 @@ static int logicvc_drm_probe(struct platform_device *pdev) goto error_clocks; } + ret =devm_request_irq (dev, irq, logicvc_drm_irq_handler,0 , +dev_name (dev), logicvc); +if (ret) { +drm_err (drm_dev,"Failed to request IRQ\n" ); + goto error_mode; + } + ret =drm_dev_register (drm_dev,0 );if (ret) {drm_err (drm_dev,"Failed to register DRM device\n" ); - goto error_mode; + goto error_irq; }drm_client_setup (drm_dev,NULL );return 0 ; +error_irq: +devm_free_irq (dev, irq, logicvc); + error_mode:logicvc_mode_fini (logicvc);
@@ -466,6 +470,7 @@ static void logicvc_drm_remove(struct platform_device *pdev)drm_dev_unregister (drm_dev);drm_atomic_helper_shutdown (drm_dev); +devm_free_irq (dev, logicvc->irq, logicvc);logicvc_mode_fini (logicvc);logicvc_clocks_unprepare (logicvc);
drivers/gpu/drm/logicvc/logicvc_drm.h +1 -0
@@ -53,6 +53,7 @@ struct logicvc_drm {struct drm_device drm_dev;phys_addr_t reserved_mem_base;struct regmap *regmap; +int irq;struct clk *vclk;struct clk *vclk2;