diff mbox series

mtd: nand: marvell: Fix missing memory allocation modifier

Message ID 20180119173901.30430-1-miquel.raynal@free-electrons.com
State Accepted
Headers show
Series mtd: nand: marvell: Fix missing memory allocation modifier | expand

Commit Message

Miquel Raynal Jan. 19, 2018, 5:39 p.m. UTC
The function marvell_nfc_init_dma() allocates a DMA buffer without the
GFP_KERNEL modifier, that triggers this warning:
"marvell_nfc_init_dma() error: no modifiers for allocation."

Fix this by using (GFP_KERNEL | GFP_DMA) instead of only GFP_DMA as the
probe happens in non-interrupt context.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
---
 drivers/mtd/nand/marvell_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Boris Brezillon Jan. 20, 2018, 1:56 p.m. UTC | #1
On Fri, 19 Jan 2018 18:39:01 +0100
Miquel Raynal <miquel.raynal@free-electrons.com> wrote:

> The function marvell_nfc_init_dma() allocates a DMA buffer without the
> GFP_KERNEL modifier, that triggers this warning:
> "marvell_nfc_init_dma() error: no modifiers for allocation."
> 
> Fix this by using (GFP_KERNEL | GFP_DMA) instead of only GFP_DMA as the
> probe happens in non-interrupt context.

Applied.

Thanks,

Boris

> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
> ---
>  drivers/mtd/nand/marvell_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
> index 48d78ca0d71c..5f49c4e0e9e1 100644
> --- a/drivers/mtd/nand/marvell_nand.c
> +++ b/drivers/mtd/nand/marvell_nand.c
> @@ -2670,7 +2670,7 @@ static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
>  	 * for DMA transfers and then copy the desired amount of data to
>  	 * the provided buffer.
>  	 */
> -	nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_DMA);
> +	nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_KERNEL | GFP_DMA);
>  	if (!nfc->dma_buf)
>  		return -ENOMEM;
>
diff mbox series

Patch

diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 48d78ca0d71c..5f49c4e0e9e1 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2670,7 +2670,7 @@  static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
 	 * for DMA transfers and then copy the desired amount of data to
 	 * the provided buffer.
 	 */
-	nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_DMA);
+	nfc->dma_buf = kmalloc(MAX_CHUNK_SIZE, GFP_KERNEL | GFP_DMA);
 	if (!nfc->dma_buf)
 		return -ENOMEM;