提交 158a0e45 编写于 作者: J Jesper Juhl 提交者: David S. Miller

[SLIP]: Remove redundant NULL pointer checks prior to kfree

Signed-off-by: NJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 18900829
...@@ -185,14 +185,11 @@ sl_alloc_bufs(struct slip *sl, int mtu) ...@@ -185,14 +185,11 @@ sl_alloc_bufs(struct slip *sl, int mtu)
/* Cleanup */ /* Cleanup */
err_exit: err_exit:
#ifdef SL_INCLUDE_CSLIP #ifdef SL_INCLUDE_CSLIP
if (cbuff)
kfree(cbuff); kfree(cbuff);
if (slcomp) if (slcomp)
slhc_free(slcomp); slhc_free(slcomp);
#endif #endif
if (xbuff)
kfree(xbuff); kfree(xbuff);
if (rbuff)
kfree(rbuff); kfree(rbuff);
return err; return err;
} }
...@@ -204,12 +201,12 @@ sl_free_bufs(struct slip *sl) ...@@ -204,12 +201,12 @@ sl_free_bufs(struct slip *sl)
void * tmp; void * tmp;
/* Free all SLIP frame buffers. */ /* Free all SLIP frame buffers. */
if ((tmp = xchg(&sl->rbuff, NULL)) != NULL) tmp = xchg(&sl->rbuff, NULL);
kfree(tmp); kfree(tmp);
if ((tmp = xchg(&sl->xbuff, NULL)) != NULL) tmp = xchg(&sl->xbuff, NULL);
kfree(tmp); kfree(tmp);
#ifdef SL_INCLUDE_CSLIP #ifdef SL_INCLUDE_CSLIP
if ((tmp = xchg(&sl->cbuff, NULL)) != NULL) tmp = xchg(&sl->cbuff, NULL);
kfree(tmp); kfree(tmp);
if ((tmp = xchg(&sl->slcomp, NULL)) != NULL) if ((tmp = xchg(&sl->slcomp, NULL)) != NULL)
slhc_free(tmp); slhc_free(tmp);
...@@ -297,12 +294,9 @@ static int sl_realloc_bufs(struct slip *sl, int mtu) ...@@ -297,12 +294,9 @@ static int sl_realloc_bufs(struct slip *sl, int mtu)
spin_unlock_bh(&sl->lock); spin_unlock_bh(&sl->lock);
done: done:
if (xbuff)
kfree(xbuff); kfree(xbuff);
if (rbuff)
kfree(rbuff); kfree(rbuff);
#ifdef SL_INCLUDE_CSLIP #ifdef SL_INCLUDE_CSLIP
if (cbuff)
kfree(cbuff); kfree(cbuff);
#endif #endif
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册