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.
Unified · Split
| @@ -1900,6 +1900,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan) · 1899 unmodified lines | ||
| 1900 | 1900 | for (i = 0; i < init_nr_desc_per_channel; i++) { |
| 1901 | 1901 | desc = at_xdmac_alloc_desc(chan, GFP_KERNEL); |
| 1902 | 1902 | if (!desc) { |
| 1903 | + if (i == 0) { | |
| 1904 | + dev_warn(chan2dev(chan), | |
| 1905 | + "can't allocate any descriptors\n"); | |
| 1906 | + return -EIO; | |
| 1907 | + } | |
| 1903 | 1908 | dev_warn(chan2dev(chan), |
| 1904 | 1909 | "only %d descriptors have been allocated\n", i); |
| 1905 | 1910 | break; |