From 9caeb26c5446fbf835c88c0bfc470d66aaad82c6 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Sun, 20 Mar 2016 21:21:36 +0800 Subject: cmd: spi: check return value of strdup Check return value of strdup. Signed-off-by: Peng Fan Cc: Przemyslaw Marczak Cc: Bin Meng Cc: Heiko Schocher Cc: Simon Glass Cc: Stefan Roese Cc: Tom Rini --- cmd/spi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd') 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) -- cgit v1.1