[PATCH] Convert to kzalloc

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Ralf Baechle 2006-07-13 12:10:48 +01:00 committed by Jeff Garzik
parent b6e37e55c2
commit 1588035265

View file

@ -94,27 +94,24 @@ slhc_init(int rslots, int tslots)
register struct cstate *ts; register struct cstate *ts;
struct slcompress *comp; struct slcompress *comp;
comp = (struct slcompress *)kmalloc(sizeof(struct slcompress), comp = (struct slcompress *)kzalloc(sizeof(struct slcompress),
GFP_KERNEL); GFP_KERNEL);
if (! comp) if (! comp)
goto out_fail; goto out_fail;
memset(comp, 0, sizeof(struct slcompress));
if ( rslots > 0 && rslots < 256 ) { if ( rslots > 0 && rslots < 256 ) {
size_t rsize = rslots * sizeof(struct cstate); size_t rsize = rslots * sizeof(struct cstate);
comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL); comp->rstate = (struct cstate *) kzalloc(rsize, GFP_KERNEL);
if (! comp->rstate) if (! comp->rstate)
goto out_free; goto out_free;
memset(comp->rstate, 0, rsize);
comp->rslot_limit = rslots - 1; comp->rslot_limit = rslots - 1;
} }
if ( tslots > 0 && tslots < 256 ) { if ( tslots > 0 && tslots < 256 ) {
size_t tsize = tslots * sizeof(struct cstate); size_t tsize = tslots * sizeof(struct cstate);
comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL); comp->tstate = (struct cstate *) kzalloc(tsize, GFP_KERNEL);
if (! comp->tstate) if (! comp->tstate)
goto out_free2; goto out_free2;
memset(comp->tstate, 0, tsize);
comp->tslot_limit = tslots - 1; comp->tslot_limit = tslots - 1;
} }