Re: mtd: nand: use dma_mapping_error to check map errors
Le Tue, 8 Aug 2017 22:35:42 +0800, Pan Biana écrit : > The return value of dma_map_single() should be checked by > dma_mapping_error(). However, in function flctl_dma_fifo0_transfer(), its > return value is checked against NULL, which could result in failures. Applied, thanks. Boris > > Signed-off-by: Pan Bian > --- > drivers/mtd/nand/sh_flctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c > index 891ac7b..2404d66 100644 > --- a/drivers/mtd/nand/sh_flctl.c > +++ b/drivers/mtd/nand/sh_flctl.c > @@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl > *flctl, unsigned long *buf, > > dma_addr = dma_map_single(chan->device->dev, buf, len, dir); > > - if (dma_addr) > + if (!dma_mapping_error(chan->device->dev, dma_addr)) > desc = dmaengine_prep_slave_single(chan, dma_addr, len, > tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); >
Re: mtd: nand: use dma_mapping_error to check map errors
Le Tue, 8 Aug 2017 22:35:42 +0800, Pan Bian a écrit : > The return value of dma_map_single() should be checked by > dma_mapping_error(). However, in function flctl_dma_fifo0_transfer(), its > return value is checked against NULL, which could result in failures. Applied, thanks. Boris > > Signed-off-by: Pan Bian > --- > drivers/mtd/nand/sh_flctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c > index 891ac7b..2404d66 100644 > --- a/drivers/mtd/nand/sh_flctl.c > +++ b/drivers/mtd/nand/sh_flctl.c > @@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl > *flctl, unsigned long *buf, > > dma_addr = dma_map_single(chan->device->dev, buf, len, dir); > > - if (dma_addr) > + if (!dma_mapping_error(chan->device->dev, dma_addr)) > desc = dmaengine_prep_slave_single(chan, dma_addr, len, > tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); >
mtd: nand: use dma_mapping_error to check map errors
The return value of dma_map_single() should be checked by dma_mapping_error(). However, in function flctl_dma_fifo0_transfer(), its return value is checked against NULL, which could result in failures. Signed-off-by: Pan Bian--- drivers/mtd/nand/sh_flctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 891ac7b..2404d66 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c @@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf, dma_addr = dma_map_single(chan->device->dev, buf, len, dir); - if (dma_addr) + if (!dma_mapping_error(chan->device->dev, dma_addr)) desc = dmaengine_prep_slave_single(chan, dma_addr, len, tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -- 1.9.1
mtd: nand: use dma_mapping_error to check map errors
The return value of dma_map_single() should be checked by dma_mapping_error(). However, in function flctl_dma_fifo0_transfer(), its return value is checked against NULL, which could result in failures. Signed-off-by: Pan Bian --- drivers/mtd/nand/sh_flctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 891ac7b..2404d66 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c @@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf, dma_addr = dma_map_single(chan->device->dev, buf, len, dir); - if (dma_addr) + if (!dma_mapping_error(chan->device->dev, dma_addr)) desc = dmaengine_prep_slave_single(chan, dma_addr, len, tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); -- 1.9.1