[PATCH] eeprom: at24: Use xasprintf for small allocation
Sascha Hauer
s.hauer at pengutronix.de
Mon Jun 27 22:43:58 PDT 2016
The code for error checking shouldn't be bigger than the allocated
string.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/eeprom/at24.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 49eef6a..7c5619b 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -438,12 +438,7 @@ static int at24_probe(struct device_d *dev)
dev_err(&client->dev, "no index found to name device\n");
goto err_device_name;
}
- devname = basprintf("eeprom%d", err);
- if (!devname) {
- err = -ENOMEM;
- dev_err(&client->dev, "failed to allocate space for device name\n");
- goto err_device_name;
- }
+ devname = xasprintf("eeprom%d", err);
}
at24->cdev.name = devname;
--
2.8.1
More information about the barebox
mailing list