summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2018-01-06 14:22:34 +0100
committerLi Yang <leoyang.li@nxp.com>2018-01-22 23:59:48 +0100
commit14b055f43915a81be46d7e98f6f237bee62c6b0c (patch)
treef388e92cf85e23a59ae65086d62f65c814e961db
parentsoc: fsl: support GUTS driver for ls1012a/ls1046a (diff)
downloadlinux-14b055f43915a81be46d7e98f6f237bee62c6b0c.tar.xz
linux-14b055f43915a81be46d7e98f6f237bee62c6b0c.zip
soc: fsl: guts: 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> Acked-by: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
-rw-r--r--drivers/soc/fsl/guts.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index d98de2c76659..302e0c8d69d9 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -167,10 +167,16 @@ static int fsl_guts_probe(struct platform_device *pdev)
} else {
soc_dev_attr.family = devm_kasprintf(dev, GFP_KERNEL, "QorIQ");
}
+ if (!soc_dev_attr.family)
+ return -ENOMEM;
soc_dev_attr.soc_id = devm_kasprintf(dev, GFP_KERNEL,
"svr:0x%08x", svr);
+ if (!soc_dev_attr.soc_id)
+ return -ENOMEM;
soc_dev_attr.revision = devm_kasprintf(dev, GFP_KERNEL, "%d.%d",
(svr >> 4) & 0xf, svr & 0xf);
+ if (!soc_dev_attr.revision)
+ return -ENOMEM;
soc_dev = soc_device_register(&soc_dev_attr);
if (IS_ERR(soc_dev))