Skip to content

Commit

Permalink
[SLIP]: Simplify sl_free_bufs()
Browse files Browse the repository at this point in the history
We can avoid assignments to the local variable 'tmp' and 
actually get rid of tmp alltogether in sl_free_bufs(). This patch does 
that.  This is safe since both kfree() and slhc_free() handles NULL 
pointers gracefully.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jesper Juhl authored and David S. Miller committed Jun 24, 2005
1 parent d675c98 commit 9b200b0
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/net/slip.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,12 @@ sl_alloc_bufs(struct slip *sl, int mtu)
static void
sl_free_bufs(struct slip *sl)
{
void * tmp;

/* Free all SLIP frame buffers. */
tmp = xchg(&sl->rbuff, NULL);
kfree(tmp);
tmp = xchg(&sl->xbuff, NULL);
kfree(tmp);
kfree(xchg(&sl->rbuff, NULL));
kfree(xchg(&sl->xbuff, NULL));
#ifdef SL_INCLUDE_CSLIP
tmp = xchg(&sl->cbuff, NULL);
kfree(tmp);
if ((tmp = xchg(&sl->slcomp, NULL)) != NULL)
slhc_free(tmp);
kfree(xchg(&sl->cbuff, NULL));
slhc_free(xchg(&sl->slcomp, NULL));
#endif
}

Expand Down

0 comments on commit 9b200b0

Please sign in to comment.