Commit 04d4b0c33f92e8431095af4c8ab1dc8098b70ae6
1 parent
9042c0e2
Simplify error handling again.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2275 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
7 deletions
elf_ops.h
@@ -167,7 +167,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | @@ -167,7 +167,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | ||
167 | if (!phdr) | 167 | if (!phdr) |
168 | goto fail; | 168 | goto fail; |
169 | if (read(fd, phdr, size) != size) | 169 | if (read(fd, phdr, size) != size) |
170 | - goto fail1; | 170 | + goto fail; |
171 | if (must_swab) { | 171 | if (must_swab) { |
172 | for(i = 0; i < ehdr.e_phnum; i++) { | 172 | for(i = 0; i < ehdr.e_phnum; i++) { |
173 | ph = &phdr[i]; | 173 | ph = &phdr[i]; |
@@ -184,9 +184,9 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | @@ -184,9 +184,9 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | ||
184 | data = qemu_mallocz(mem_size); | 184 | data = qemu_mallocz(mem_size); |
185 | if (ph->p_filesz > 0) { | 185 | if (ph->p_filesz > 0) { |
186 | if (lseek(fd, ph->p_offset, SEEK_SET) < 0) | 186 | if (lseek(fd, ph->p_offset, SEEK_SET) < 0) |
187 | - goto fail2; | 187 | + goto fail; |
188 | if (read(fd, data, ph->p_filesz) != ph->p_filesz) | 188 | if (read(fd, data, ph->p_filesz) != ph->p_filesz) |
189 | - goto fail2; | 189 | + goto fail; |
190 | } | 190 | } |
191 | addr = ph->p_vaddr + virt_to_phys_addend; | 191 | addr = ph->p_vaddr + virt_to_phys_addend; |
192 | 192 | ||
@@ -200,11 +200,8 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | @@ -200,11 +200,8 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend, | ||
200 | } | 200 | } |
201 | qemu_free(phdr); | 201 | qemu_free(phdr); |
202 | return total_size; | 202 | return total_size; |
203 | -fail2: | 203 | + fail: |
204 | qemu_free(data); | 204 | qemu_free(data); |
205 | -fail1: | ||
206 | qemu_free(phdr); | 205 | qemu_free(phdr); |
207 | -fail: | ||
208 | return -1; | 206 | return -1; |
209 | } | 207 | } |
210 | - |