Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91e9dd77 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Miquel Raynal
Browse files

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: 8fae856c ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: default avatarLiang Yang <liang.yang@amlogic.com>
Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent b849f8b5
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -528,6 +528,9 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
	u8 *info;
	u8 *info;


	info = kzalloc(PER_INFO_BYTE, GFP_KERNEL);
	info = kzalloc(PER_INFO_BYTE, GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	ret = meson_nfc_dma_buffer_setup(nand, buf, len, info,
	ret = meson_nfc_dma_buffer_setup(nand, buf, len, info,
					 PER_INFO_BYTE, DMA_FROM_DEVICE);
					 PER_INFO_BYTE, DMA_FROM_DEVICE);
	if (ret)
	if (ret)