ath79: use both WNDR3x00 power leds for boot status indication
[openwrt/openwrt.git] / target / linux / ipq40xx / patches-4.14 / 050-0006-mtd-nand-qcom-Add-a-NULL-check-for-devm_kasprintf.patch
1 From 069f05346d01e7298939f16533953cdf52370be3 Mon Sep 17 00:00:00 2001
2 From: Fabio Estevam <fabio.estevam@nxp.com>
3 Date: Fri, 5 Jan 2018 18:02:55 -0200
4 Subject: [PATCH 6/7] mtd: nand: qcom: Add a NULL check for devm_kasprintf()
5
6 devm_kasprintf() may fail, so we should better add a NULL check
7 and propagate an error on failure.
8
9 Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
10 Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
11 ---
12 drivers/mtd/nand/qcom_nandc.c | 3 +++
13 1 file changed, 3 insertions(+)
14
15 --- a/drivers/mtd/nand/qcom_nandc.c
16 +++ b/drivers/mtd/nand/qcom_nandc.c
17 @@ -2639,6 +2639,9 @@ static int qcom_nand_host_init(struct qc
18
19 nand_set_flash_node(chip, dn);
20 mtd->name = devm_kasprintf(dev, GFP_KERNEL, "qcom_nand.%d", host->cs);
21 + if (!mtd->name)
22 + return -ENOMEM;
23 +
24 mtd->owner = THIS_MODULE;
25 mtd->dev.parent = dev;
26