diff options
author | Milton Miller <miltonm@bga.com> | 2007-09-21 19:03:52 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-02 21:48:43 -0400 |
commit | 51a505d73bfed863135861fdc0496a09766b69d5 (patch) | |
tree | 4ee03e6d150f7553e77a4d8d67da06711a6f5ee9 /arch/powerpc/boot/gunzip_util.c | |
parent | e47654d016c68a02f654ac16951577804f7789c7 (diff) |
[POWERPC] boot: Simplify gunzip_finish
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>
Diffstat (limited to 'arch/powerpc/boot/gunzip_util.c')
-rw-r--r-- | arch/powerpc/boot/gunzip_util.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/powerpc/boot/gunzip_util.c b/arch/powerpc/boot/gunzip_util.c index e1e215e16983..ef2aed0f63ca 100644 --- a/arch/powerpc/boot/gunzip_util.c +++ b/arch/powerpc/boot/gunzip_util.c | |||
@@ -194,13 +194,10 @@ int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen) | |||
194 | { | 194 | { |
195 | int len; | 195 | int len; |
196 | 196 | ||
197 | len = gunzip_partial(state, dst, dstlen); | ||
198 | |||
197 | if (state->s.workspace) { | 199 | if (state->s.workspace) { |
198 | len = gunzip_partial(state, dst, dstlen); | ||
199 | zlib_inflateEnd(&state->s); | 200 | zlib_inflateEnd(&state->s); |
200 | } else { | ||
201 | /* uncompressed image */ | ||
202 | len = min(state->s.avail_in, (unsigned)dstlen); | ||
203 | memcpy(dst, state->s.next_in, len); | ||
204 | } | 201 | } |
205 | 202 | ||
206 | return len; | 203 | return len; |