summaryrefslogtreecommitdiffstats
path: root/drivers/net/slhc.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /drivers/net/slhc.c
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'drivers/net/slhc.c')
-rw-r--r--drivers/net/slhc.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c
index 187e51616..13a020869 100644
--- a/drivers/net/slhc.c
+++ b/drivers/net/slhc.c
@@ -99,21 +99,18 @@ slhc_init(int rslots, int tslots)
register struct cstate *ts;
struct slcompress *comp;
+ MOD_INC_USE_COUNT;
comp = (struct slcompress *)kmalloc(sizeof(struct slcompress),
GFP_KERNEL);
if (! comp)
- return NULL;
-
+ goto out_fail;
memset(comp, 0, sizeof(struct slcompress));
if ( rslots > 0 && rslots < 256 ) {
size_t rsize = rslots * sizeof(struct cstate);
comp->rstate = (struct cstate *) kmalloc(rsize, GFP_KERNEL);
if (! comp->rstate)
- {
- kfree((unsigned char *)comp);
- return NULL;
- }
+ goto out_free;
memset(comp->rstate, 0, rsize);
comp->rslot_limit = rslots - 1;
}
@@ -122,11 +119,7 @@ slhc_init(int rslots, int tslots)
size_t tsize = tslots * sizeof(struct cstate);
comp->tstate = (struct cstate *) kmalloc(tsize, GFP_KERNEL);
if (! comp->tstate)
- {
- kfree((unsigned char *)comp->rstate);
- kfree((unsigned char *)comp);
- return NULL;
- }
+ goto out_free2;
memset(comp->tstate, 0, tsize);
comp->tslot_limit = tslots - 1;
}
@@ -151,8 +144,15 @@ slhc_init(int rslots, int tslots)
ts[0].next = &(ts[comp->tslot_limit]);
ts[0].cs_this = 0;
}
- MOD_INC_USE_COUNT;
return comp;
+
+out_free2:
+ kfree((unsigned char *)comp->rstate);
+out_free:
+ kfree((unsigned char *)comp);
+out_fail:
+ MOD_DEC_USE_COUNT;
+ return NULL;
}
@@ -163,14 +163,14 @@ slhc_free(struct slcompress *comp)
if ( comp == NULLSLCOMPR )
return;
- if ( comp->rstate != NULLSLSTATE )
- kfree( comp->rstate );
-
if ( comp->tstate != NULLSLSTATE )
kfree( comp->tstate );
- MOD_DEC_USE_COUNT;
+ if ( comp->rstate != NULLSLSTATE )
+ kfree( comp->rstate );
+
kfree( comp );
+ MOD_DEC_USE_COUNT;
}