Skip to content

Commit 3770d92

Browse files
mwallevinodkoul
authored andcommitted
dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly
It seems that it is valid to have less than the requested number of descriptors. But what is not valid and leads to subsequent errors is to have zero descriptors. In that case, abort the probing. Fixes: e1f7c9e ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver") Signed-off-by: Michael Walle <michael@walle.cc> Link: https://lore.kernel.org/r/20220526135111.1470926-1-michael@walle.cc Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 09f7b80 commit 3770d92

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/dma/at_xdmac.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan)
19001900
for (i = 0; i < init_nr_desc_per_channel; i++) {
19011901
desc = at_xdmac_alloc_desc(chan, GFP_KERNEL);
19021902
if (!desc) {
1903+
if (i == 0) {
1904+
dev_warn(chan2dev(chan),
1905+
"can't allocate any descriptors\n");
1906+
return -EIO;
1907+
}
19031908
dev_warn(chan2dev(chan),
19041909
"only %d descriptors have been allocated\n", i);
19051910
break;

0 commit comments

Comments
 (0)