diff options
author | Peng Fan <van.freenix@gmail.com> | 2016-03-20 21:21:36 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-03-27 09:12:55 -0400 |
commit | 9caeb26c5446fbf835c88c0bfc470d66aaad82c6 (patch) | |
tree | f8cfc39f4e037db1147ad018a4ef933024ef9164 /cmd | |
parent | 3917c26909e4021c73073672865ec456eb51d640 (diff) |
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>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/spi.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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) |