History

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.

Michael Walle committed 4 years ago

Commit 3770d921 parent 09f7b801 file · +5 −0Browse files

Unified · Split

drivers/dma/at_xdmac.c+5−0
@@ -1900,6 +1900,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan) · 1899 unmodified lines
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;