linux/drivers/media/platform/st/stm32
Dan Carpenter f1d1ed39ce media: stm32: dcmi: fix some error handling bugs in probe()
There are a few issues here:

1) After we assign:
        chan = dma_request_chan(&pdev->dev, "tx");
   Then the error paths need to clean up before returning.  The first
   error path does a direct return.
2) The error paths check "dcmi->mdma_chan" but that is not assigned
   until later so it results in memory leaks.  Test "mdma_chan"
   instead.
3) The error handling calls dma_release_channel(dcmi->dma_chan) before
   "dcmi->dma_chan" has been assigned which leads to a NULL pointer
   dereference.  Use the "chan" variable instead.

I also moved the call to dma_release_channel() after the call to
dma_release_channel() so it mirrors the allocation code better.

Fixes: bc901885fa ("media: stm32: dcmi: perform dmaengine_slave_config at probe")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2026-07-30 01:10:28 +03:00
..
dma2d Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stm32-dcmipp media: stm32: dcmipp: Propagate runtime resume errors 2026-07-15 17:12:55 +02:00
Kconfig media: stm32: csi: addition of the STM32 CSI driver 2024-12-12 13:22:25 +01:00
Makefile media: stm32: csi: addition of the STM32 CSI driver 2024-12-12 13:22:25 +01:00
stm32-csi.c media: stm32-csi: Fix dereference before NULL check 2025-08-25 15:40:44 +02:00
stm32-dcmi.c media: stm32: dcmi: fix some error handling bugs in probe() 2026-07-30 01:10:28 +03:00