[PATCH] eeprom: at24: Use xasprintf for small allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux