Commit 9caeb26c authored by Peng Fan's avatar Peng Fan Committed by Tom Rini

cmd: spi: check return value of strdup

Check return value of strdup.
Signed-off-by: default avatarPeng Fan <>
Cc: Przemyslaw Marczak <>
Cc: Bin Meng <>
Cc: Heiko Schocher <>
Cc: Simon Glass <>
Cc: Stefan Roese <>
Cc: Tom Rini <>
parent 3917c269
......@@ -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)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment