summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2016-03-20 21:21:36 +0800
committerTom Rini <trini@konsulko.com>2016-03-27 09:12:55 -0400
commit9caeb26c5446fbf835c88c0bfc470d66aaad82c6 (patch)
treef8cfc39f4e037db1147ad018a4ef933024ef9164
parent3917c26909e4021c73073672865ec456eb51d640 (diff)
downloadu-boot-imx-9caeb26c5446fbf835c88c0bfc470d66aaad82c6.zip
u-boot-imx-9caeb26c5446fbf835c88c0bfc470d66aaad82c6.tar.gz
u-boot-imx-9caeb26c5446fbf835c88c0bfc470d66aaad82c6.tar.bz2
cmd: spi: check return value of strdup
Check return value of strdup. Signed-off-by: Peng Fan <van.freenix@gmail.com> Cc: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Cc: Tom Rini <trini@konsulko.com>
-rw-r--r--cmd/spi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/spi.c b/cmd/spi.c
index 64c3ffc..f16ef9a 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -51,6 +51,8 @@ static int do_spi_xfer(int bus, int cs)
snprintf(name, sizeof(name), "generic_%d:%d", bus, cs);
str = strdup(name);
+ if (!str)
+ return -ENOMEM;
ret = spi_get_bus_and_cs(bus, cs, 1000000, mode, "spi_generic_drv",
str, &dev, &slave);
if (ret)