X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fppp_deflate.c;h=72c8d6628f583a041023dfab6a90d7922e101cf8;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=df75c94e1d0c4ffd4a973a3fab7cf9279c5fdbb1;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/net/ppp_deflate.c b/drivers/net/ppp_deflate.c index df75c94e1..72c8d6628 100644 --- a/drivers/net/ppp_deflate.c +++ b/drivers/net/ppp_deflate.c @@ -87,8 +87,7 @@ static void z_comp_free(void *arg) if (state) { zlib_deflateEnd(&state->strm); - if (state->strm.workspace) - vfree(state->strm.workspace); + vfree(state->strm.workspace); kfree(state); } } @@ -122,7 +121,7 @@ static void *z_comp_alloc(unsigned char *options, int opt_len) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) return NULL; - state = (struct ppp_deflate_state *) kmalloc(sizeof(*state), + state = kmalloc(sizeof(*state), GFP_KERNEL); if (state == NULL) return NULL; @@ -308,8 +307,7 @@ static void z_decomp_free(void *arg) if (state) { zlib_inflateEnd(&state->strm); - if (state->strm.workspace) - kfree(state->strm.workspace); + kfree(state->strm.workspace); kfree(state); } } @@ -343,7 +341,7 @@ static void *z_decomp_alloc(unsigned char *options, int opt_len) if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) return NULL; - state = (struct ppp_deflate_state *) kmalloc(sizeof(*state), GFP_KERNEL); + state = kmalloc(sizeof(*state), GFP_KERNEL); if (state == NULL) return NULL; @@ -600,7 +598,7 @@ extern void ppp_unregister_compressor (struct compressor *cp); /* * Procedures exported to if_ppp.c. */ -struct compressor ppp_deflate = { +static struct compressor ppp_deflate = { .compress_proto = CI_DEFLATE, .comp_alloc = z_comp_alloc, .comp_free = z_comp_free, @@ -618,7 +616,7 @@ struct compressor ppp_deflate = { .owner = THIS_MODULE }; -struct compressor ppp_deflate_draft = { +static struct compressor ppp_deflate_draft = { .compress_proto = CI_DEFLATE_DRAFT, .comp_alloc = z_comp_alloc, .comp_free = z_comp_free, @@ -637,7 +635,7 @@ struct compressor ppp_deflate_draft = { }; static int __init deflate_init(void) -{ +{ int answer = ppp_register_compressor(&ppp_deflate); if (answer == 0) printk(KERN_INFO @@ -645,7 +643,7 @@ static int __init deflate_init(void) ppp_register_compressor(&ppp_deflate_draft); return answer; } - + static void __exit deflate_cleanup(void) { ppp_unregister_compressor(&ppp_deflate);