diff options
author | Fabio Estevam <fabio.estevam@nxp.com> | 2018-01-05 18:02:55 -0200 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2018-01-06 21:55:42 +0100 |
commit | 069f05346d01e7298939f16533953cdf52370be3 (patch) | |
tree | a97ad81733fb534fc2e990e4ff86caff9a1e08d3 | |
parent | 039b4377e5621a2cc197a7aff1e06db432e4dcc2 (diff) | |
download | blackbird-op-linux-069f05346d01e7298939f16533953cdf52370be3.tar.gz blackbird-op-linux-069f05346d01e7298939f16533953cdf52370be3.zip |
mtd: nand: qcom: Add a NULL check for devm_kasprintf()
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>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r-- | drivers/mtd/nand/qcom_nandc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c index 245d0f39e0aa..6be555806eca 100644 --- a/drivers/mtd/nand/qcom_nandc.c +++ b/drivers/mtd/nand/qcom_nandc.c @@ -2639,6 +2639,9 @@ 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; |