[POWERPC] boot: Simplify gunzip_finish
authorMilton Miller <miltonm@bga.com>
Fri, 21 Sep 2007 23:03:52 +0000 (09:03 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 3 Oct 2007 01:48:43 +0000 (11:48 +1000)
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>
arch/powerpc/boot/gunzip_util.c

index e1e215e16983cced81a78e14fb9c51aead147e8c..ef2aed0f63ca8c6eb9523495513b0fc008fa96fa 100644 (file)
@@ -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;