Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: fsl-edma: fix miss mutex unlock at an error return path

Use cleanup to manage mutex. Let compiler to do scope guard automatically.

Fixes: 6aa60f79e679 ("dmaengine: fsl-edma: add safety check for 'srcid'")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202404110915.riwV3ZAC-lkp@intel.com/
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240411203935.3137158-1-Frank.Li@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Frank Li and committed by
Vinod Koul
b52e28ec 4665be0e

+3 -3
+1
drivers/dma/fsl-edma-common.c
··· 3 3 // Copyright (c) 2013-2014 Freescale Semiconductor, Inc 4 4 // Copyright (c) 2017 Sysam, Angelo Dureghello <angelo@sysam.it> 5 5 6 + #include <linux/cleanup.h> 6 7 #include <linux/clk.h> 7 8 #include <linux/dmapool.h> 8 9 #include <linux/module.h>
+2 -3
drivers/dma/fsl-edma-main.c
··· 105 105 if (dma_spec->args_count != 2) 106 106 return NULL; 107 107 108 - mutex_lock(&fsl_edma->fsl_edma_mutex); 108 + guard(mutex)(&fsl_edma->fsl_edma_mutex); 109 + 109 110 list_for_each_entry_safe(chan, _chan, &fsl_edma->dma_dev.channels, device_node) { 110 111 if (chan->client_count) 111 112 continue; ··· 125 124 126 125 fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid, 127 126 true); 128 - mutex_unlock(&fsl_edma->fsl_edma_mutex); 129 127 return chan; 130 128 } 131 129 } 132 130 } 133 - mutex_unlock(&fsl_edma->fsl_edma_mutex); 134 131 return NULL; 135 132 } 136 133