Skip to content

Commit

Permalink
[POWERPC] boot: Simplify gunzip_finish
Browse files Browse the repository at this point in the history
Call gunzip_partial to calculate the remaining length and copy the
data to the user buffer.  This makes it shorter and reduces
duplication.

Signed-off-by: Milton Miller <miltonm@bga.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Milton Miller authored and Paul Mackerras committed Oct 3, 2007
1 parent e47654d commit 51a505d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions arch/powerpc/boot/gunzip_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,10 @@ int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen)
{
int len;

len = gunzip_partial(state, dst, dstlen);

if (state->s.workspace) {
len = gunzip_partial(state, dst, dstlen);
zlib_inflateEnd(&state->s);
} else {
/* uncompressed image */
len = min(state->s.avail_in, (unsigned)dstlen);
memcpy(dst, state->s.next_in, len);
}

return len;
Expand Down

0 comments on commit 51a505d

Please sign in to comment.