diff options
author | Martin Blumenstingl <martin.blumenstingl@googlemail.com> | 2019-03-18 23:47:21 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-03-21 18:48:57 +0300 |
commit | 91e9dd7720848fc0bd1c0a96d4dd0b169d8e542a (patch) | |
tree | d960ab3b08fbede59422737f59ee3f990a1afa5e /drivers/mtd/nand/raw/meson_nand.c | |
parent | b849f8b59c682c2f3c55e14224d6d4d5360fc605 (diff) | |
download | linux-91e9dd7720848fc0bd1c0a96d4dd0b169d8e542a.tar.xz |
mtd: rawnand: meson: add missing ENOMEM check in meson_nfc_read_buf()
kzalloc() can return NULL if memory could not be allocated. Check the
return value of the kzalloc() call in meson_nfc_read_buf() to make it
consistent with other memory allocations within the meson_nand driver.
Fixes: 8fae856c53500a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Liang Yang <liang.yang@amlogic.com>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/meson_nand.c')
-rw-r--r-- | drivers/mtd/nand/raw/meson_nand.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 3e8aa71407b5..a1d8506b61c7 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -528,6 +528,9 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len) u8 *info; info = kzalloc(PER_INFO_BYTE, GFP_KERNEL); + if (!info) + return -ENOMEM; + ret = meson_nfc_dma_buffer_setup(nand, buf, len, info, PER_INFO_BYTE, DMA_FROM_DEVICE); if (ret) |