提交 9b200b02 编写于 作者: J Jesper Juhl 提交者: David S. Miller

[SLIP]: Simplify sl_free_bufs()

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: NJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d675c989
......@@ -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
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册