From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] eeprom: at24: Use xasprintf for small allocation
Date: Tue, 28 Jun 2016 07:43:58 +0200 [thread overview]
Message-ID: <1467092638-28438-1-git-send-email-s.hauer@pengutronix.de> (raw)
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
reply other threads:[~2016-06-28 5:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467092638-28438-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox