Skip to content

Commit

Permalink
mtd: nand: qcom: Add a NULL check for devm_kasprintf()
Browse files Browse the repository at this point in the history
commit 069f053 upstream.

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>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Fabio Estevam authored and gregkh committed Aug 15, 2018
1 parent e5751c8 commit 2424869
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/nand/qcom_nandc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2544,6 +2544,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;

Expand Down

0 comments on commit 2424869

Please sign in to comment.