mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly
commit3770d92bd5
upstream. 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:e1f7c9eee7
("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b91312b507
commit
bce1b24d66
1 changed files with 5 additions and 0 deletions
|
@ -1804,6 +1804,11 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan)
|
|||
for (i = 0; i < init_nr_desc_per_channel; i++) {
|
||||
desc = at_xdmac_alloc_desc(chan, GFP_ATOMIC);
|
||||
if (!desc) {
|
||||
if (i == 0) {
|
||||
dev_warn(chan2dev(chan),
|
||||
"can't allocate any descriptors\n");
|
||||
return -EIO;
|
||||
}
|
||||
dev_warn(chan2dev(chan),
|
||||
"only %d descriptors have been allocated\n", i);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue