public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: qcom_nandc: Add a NULL check for devm_kasprintf()
@ 2018-01-05 20:02 Fabio Estevam
  2018-01-05 20:02 ` [PATCH 2/2] mtd: brcmnand: " Fabio Estevam
  2018-01-07 10:04 ` [PATCH 1/2] mtd: qcom_nandc: " Boris Brezillon
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2018-01-05 20:02 UTC (permalink / raw)
  To: boris.brezillon
  Cc: cyrille.pitchen, architt, linux-mtd, computersforpeace,
	Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

devm_kasprintf() may fail, so we should better add a NULL check
and propagate an error on failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/mtd/nand/qcom_nandc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
index 245d0f3..3fe2ff8 100644
--- a/drivers/mtd/nand/qcom_nandc.c
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -2639,6 +2639,8 @@ static int qcom_nand_host_init(struct qcom_nand_controller *nandc,
 
 	nand_set_flash_node(chip, dn);
 	mtd->name = devm_kasprintf(dev, GFP_KERNEL, "qcom_nand.%d", host->cs);
+	if (!mtd->name)
+		return -ENOMEM;
 	mtd->owner = THIS_MODULE;
 	mtd->dev.parent = dev;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-07 10:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 20:02 [PATCH 1/2] mtd: qcom_nandc: Add a NULL check for devm_kasprintf() Fabio Estevam
2018-01-05 20:02 ` [PATCH 2/2] mtd: brcmnand: " Fabio Estevam
2018-01-06  9:35   ` Boris Brezillon
2018-01-06 20:40     ` Boris Brezillon
2018-01-07 10:04 ` [PATCH 1/2] mtd: qcom_nandc: " Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox