drm: renesas: rz-du: mipi_dsi: Fix return path on error
Subsystems (3)
PATCH 1/1 drm: renesas: rz-du: mipi_dsi: Fix return path on error
In case of error, we should unwind correctly.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +4 -2
@@ -1476,8 +1476,10 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , &dsi->dcs_buf_phys,GFP_KERNEL ); -if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_pm_disable; + }return 0 ;
Signature · 1 line
2.52.0
Hi Chris,
Quoted 5 lines · On Fri, 17 Apr 2026 10:02:31 -0400 Chris Brandt <[email protected]>…
In case of error, we should unwind correctly.
Fixes 6f392f371650 ("drm: renesas: rz-du: Implement MIPI DSI host transfers")Suggested-by Pavel Machek <[email protected]>Signed-off-by Chris Brandt <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +4
-2@@ -1476,8 +1476,10 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , &dsi->dcs_buf_phys,GFP_KERNEL ); -if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_pm_disable; + }return 0 ;Signature · 1 line
2.52.0
Signature · 1 line
Hugo Villeneuve
Hi Chris,
Quoted 5 lines · Chris Brandt
In case of error, we should unwind correctly.
Fixes 6f392f371650 ("drm: renesas: rz-du: Implement MIPI DSI host transfers")Suggested-by Pavel Machek <[email protected]>Signed-off-by Chris Brandt <[email protected]>
Thanks for your patch!
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) · line 1481
Quoted 11 lines
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +3
-2@@ -1476,8 +1476,10 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , &dsi->dcs_buf_phys,GFP_KERNEL ); -if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_pm_disable;
Shouldn't you call mipi_dsi_host_unregister(&dsi->host) first?
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) · line 1485
Quoted 4 lines
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1
-0+ }return 0 ;
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi Geert,
Quoted 7 lines · Geert Uytterhoeven
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) · line 1481
Quoted 5 lines
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +3
-2-if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_pm_disable;Shouldn't you call
mipi_dsi_host_unregister(&dsi->host)first?
Good point.
Since it doesn't really matter -when- that memory is allocated in probe, maybe I'll just keep the original lines, just move them earlier in the function when all the other resources are being allocated using devm_xxx.
Then I don't have to worry about the it anymore.
Thanks,
Chris
Hi Geert,
Quoted 4 lines · Chris Brandt
Since it doesn't really matter -when- that memory is allocated in probe, maybe I'll just keep the original lines, just move them earlier in the function when all the other resources are being allocated using
devm_xxx.Then I don't have to worry about the it anymore.
Oh wait, I guess I also need to change from calling dma_alloc_coherent() to dmam_alloc_coherent() so it will automatically unwind.
And then, I can remove the call to dma_free_coherent() in rzg2l_mipi_dsi_remove() as well.
Does this sound like a better idea?
Chris
Hi Chris,
Quoted 11 lines · Chris Brandt
Quoted 4 lines · Chris Brandt
Since it doesn't really matter -when- that memory is allocated in probe, maybe I'll just keep the original lines, just move them earlier in the function when all the other resources are being allocated using
devm_xxx.Then I don't have to worry about the it anymore.
Oh wait, I guess I also need to change from calling
dma_alloc_coherent()todmam_alloc_coherent()so it will automatically unwind.And then, I can remove the call to
dma_free_coherent()inrzg2l_mipi_dsi_remove()as well.Does this sound like a better idea?
Sounds fine to me!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds