mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] eeprom: at24: Use xasprintf for small allocation
@ 2016-06-28  5:43 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2016-06-28  5:43 UTC (permalink / raw)
  To: Barebox List

The code for error checking shouldn't be bigger than the allocated
string.

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-28  5:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28  5:43 [PATCH] eeprom: at24: Use xasprintf for small allocation Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox