summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-04 11:26:02 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2015-02-10 09:27:20 +0300
commit6b0126f94099db15fb0110218b17eeccefa077d1 (patch)
treee4b31f0b79f1154702f3a9ba5bb87a68fa69e5f9
parentbe7433efbf8b4134ab9763abdecaf2e6a35e1ed1 (diff)
downloadqemu-6b0126f94099db15fb0110218b17eeccefa077d1.tar.gz
qemu-6b0126f94099db15fb0110218b17eeccefa077d1.tar.bz2
qemu-6b0126f94099db15fb0110218b17eeccefa077d1.zip
onenand: g_malloc() can't fail, bury dead error handling
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--hw/block/onenand.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 348630d905..1b2c893756 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -346,15 +346,9 @@ static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn,
static inline int onenand_erase(OneNANDState *s, int sec, int num)
{
uint8_t *blankbuf, *tmpbuf;
+
blankbuf = g_malloc(512);
- if (!blankbuf) {
- return 1;
- }
tmpbuf = g_malloc(512);
- if (!tmpbuf) {
- g_free(blankbuf);
- return 1;
- }
memset(blankbuf, 0xff, 512);
for (; num > 0; num--, sec++) {
if (s->blk_cur) {