Skip to content

Commit

Permalink
[SLIP]: Remove redundant NULL pointer checks prior to kfree
Browse files Browse the repository at this point in the history
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 Apr 25, 2005
1 parent 1890082 commit 158a0e4
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions drivers/net/slip.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,12 @@ sl_alloc_bufs(struct slip *sl, int mtu)
/* Cleanup */
err_exit:
#ifdef SL_INCLUDE_CSLIP
if (cbuff)
kfree(cbuff);
kfree(cbuff);
if (slcomp)
slhc_free(slcomp);
#endif
if (xbuff)
kfree(xbuff);
if (rbuff)
kfree(rbuff);
kfree(xbuff);
kfree(rbuff);
return err;
}

Expand All @@ -204,13 +201,13 @@ sl_free_bufs(struct slip *sl)
void * tmp;

/* Free all SLIP frame buffers. */
if ((tmp = xchg(&sl->rbuff, NULL)) != NULL)
kfree(tmp);
if ((tmp = xchg(&sl->xbuff, NULL)) != NULL)
kfree(tmp);
tmp = xchg(&sl->rbuff, NULL);
kfree(tmp);
tmp = xchg(&sl->xbuff, NULL);
kfree(tmp);
#ifdef SL_INCLUDE_CSLIP
if ((tmp = xchg(&sl->cbuff, NULL)) != NULL)
kfree(tmp);
tmp = xchg(&sl->cbuff, NULL);
kfree(tmp);
if ((tmp = xchg(&sl->slcomp, NULL)) != NULL)
slhc_free(tmp);
#endif
Expand Down Expand Up @@ -297,13 +294,10 @@ static int sl_realloc_bufs(struct slip *sl, int mtu)
spin_unlock_bh(&sl->lock);

done:
if (xbuff)
kfree(xbuff);
if (rbuff)
kfree(rbuff);
kfree(xbuff);
kfree(rbuff);
#ifdef SL_INCLUDE_CSLIP
if (cbuff)
kfree(cbuff);
kfree(cbuff);
#endif
return err;
}
Expand Down

0 comments on commit 158a0e4

Please sign in to comment.