From: ths Date: Sat, 23 Dec 2006 15:18:47 +0000 (+0000) Subject: Simplify error handling again. X-Git-Tag: release_0_9_1~1620 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=255d4f6dd496d2d529bce38a85cc02199833f080;p=qemu-xen-4.6-testing.git Simplify error handling again. --- diff --git a/elf_ops.h b/elf_ops.h index 1cd4f2b3d..abcce093e 100644 --- a/elf_ops.h +++ b/elf_ops.h @@ -167,7 +167,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, if (!phdr) goto fail; if (read(fd, phdr, size) != size) - goto fail1; + goto fail; if (must_swab) { for(i = 0; i < ehdr.e_phnum; i++) { ph = &phdr[i]; @@ -184,9 +184,9 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, data = qemu_mallocz(mem_size); if (ph->p_filesz > 0) { if (lseek(fd, ph->p_offset, SEEK_SET) < 0) - goto fail2; + goto fail; if (read(fd, data, ph->p_filesz) != ph->p_filesz) - goto fail2; + goto fail; } addr = ph->p_vaddr + virt_to_phys_addend; @@ -200,11 +200,8 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, } qemu_free(phdr); return total_size; -fail2: + fail: qemu_free(data); -fail1: qemu_free(phdr); -fail: return -1; } -