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
1900 for (i = 0; i < init_nr_desc_per_channel; i++) {1900 for (i = 0; i < init_nr_desc_per_channel; i++) {
1901 desc = at_xdmac_alloc_desc(chan, GFP_KERNEL);1901 desc = at_xdmac_alloc_desc(chan, GFP_KERNEL);
1902 if (!desc) {1902 if (!desc) {
1903 if (i == 0) {
1904 dev_warn(chan2dev(chan),
1905 "can't allocate any descriptors\n");
1906 return -EIO;
1907 }
1903 dev_warn(chan2dev(chan),1908 dev_warn(chan2dev(chan),
1904 "only %d descriptors have been allocated\n", i);1909 "only %d descriptors have been allocated\n", i);
1905 break;1910 break;