mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
dm: i2c: Add a missing memory allocaton check
This strdup() is missing a check. Add it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
parent
694cc87b76
commit
5c2d23bf9e
1 changed files with 2 additions and 0 deletions
|
@ -230,6 +230,8 @@ static int i2c_bind_driver(struct udevice *bus, uint chip_addr, uint offset_len,
|
|||
|
||||
snprintf(name, sizeof(name), "generic_%x", chip_addr);
|
||||
str = strdup(name);
|
||||
if (!str)
|
||||
return -ENOMEM;
|
||||
ret = device_bind_driver(bus, "i2c_generic_chip_drv", str, &dev);
|
||||
debug("%s: device_bind_driver: ret=%d\n", __func__, ret);
|
||||
if (ret)
|
||||
|
|
Loading…
Reference in a new issue