diff options
Diffstat (limited to 'drivers/net/slhc.c')
-rw-r--r-- | drivers/net/slhc.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index 3a1b7131681c..9a540e2092b9 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c | |||
@@ -94,27 +94,23 @@ slhc_init(int rslots, int tslots) | |||
94 | register struct cstate *ts; | 94 | register struct cstate *ts; |
95 | struct slcompress *comp; | 95 | struct slcompress *comp; |
96 | 96 | ||
97 | comp = (struct slcompress *)kmalloc(sizeof(struct slcompress), | 97 | comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL); |
98 | GFP_KERNEL); | ||
99 | if (! comp) | 98 | if (! comp) |
100 | goto out_fail; | 99 | goto out_fail; |
101 | memset(comp, 0, sizeof(struct slcompress)); | ||
102 | 100 | ||
103 | if ( rslots > 0 && rslots < 256 ) { | 101 | if ( rslots > 0 && rslots < 256 ) { |
104 | size_t rsize = rslots * sizeof(struct cstate); | 102 | size_t rsize = rslots * sizeof(struct cstate); |
105 | comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL); | 103 | comp->rstate = kzalloc(rsize, GFP_KERNEL); |
106 | if (! comp->rstate) | 104 | if (! comp->rstate) |
107 | goto out_free; | 105 | goto out_free; |
108 | memset(comp->rstate, 0, rsize); | ||
109 | comp->rslot_limit = rslots - 1; | 106 | comp->rslot_limit = rslots - 1; |
110 | } | 107 | } |
111 | 108 | ||
112 | if ( tslots > 0 && tslots < 256 ) { | 109 | if ( tslots > 0 && tslots < 256 ) { |
113 | size_t tsize = tslots * sizeof(struct cstate); | 110 | size_t tsize = tslots * sizeof(struct cstate); |
114 | comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL); | 111 | comp->tstate = kzalloc(tsize, GFP_KERNEL); |
115 | if (! comp->tstate) | 112 | if (! comp->tstate) |
116 | goto out_free2; | 113 | goto out_free2; |
117 | memset(comp->tstate, 0, tsize); | ||
118 | comp->tslot_limit = tslots - 1; | 114 | comp->tslot_limit = tslots - 1; |
119 | } | 115 | } |
120 | 116 | ||
@@ -141,9 +137,9 @@ slhc_init(int rslots, int tslots) | |||
141 | return comp; | 137 | return comp; |
142 | 138 | ||
143 | out_free2: | 139 | out_free2: |
144 | kfree((unsigned char *)comp->rstate); | 140 | kfree(comp->rstate); |
145 | out_free: | 141 | out_free: |
146 | kfree((unsigned char *)comp); | 142 | kfree(comp); |
147 | out_fail: | 143 | out_fail: |
148 | return NULL; | 144 | return NULL; |
149 | } | 145 | } |
@@ -700,20 +696,6 @@ EXPORT_SYMBOL(slhc_compress); | |||
700 | EXPORT_SYMBOL(slhc_uncompress); | 696 | EXPORT_SYMBOL(slhc_uncompress); |
701 | EXPORT_SYMBOL(slhc_toss); | 697 | EXPORT_SYMBOL(slhc_toss); |
702 | 698 | ||
703 | #ifdef MODULE | ||
704 | |||
705 | int init_module(void) | ||
706 | { | ||
707 | printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California\n"); | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | void cleanup_module(void) | ||
712 | { | ||
713 | return; | ||
714 | } | ||
715 | |||
716 | #endif /* MODULE */ | ||
717 | #else /* CONFIG_INET */ | 699 | #else /* CONFIG_INET */ |
718 | 700 | ||
719 | 701 | ||