* [PATCH] net: remove redundant NULL pointer checks prior to kfree in drivers/net/slip.c
@ 2005-04-11 21:15 Jesper Juhl
2005-04-25 1:59 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2005-04-11 21:15 UTC (permalink / raw)
To: linux-kernel; +Cc: Laurence Culhane, Fred N. van Kempen, netdev
kfree() checks for NULL. Checking prior to calling it is redundant.
This patch removes these redundant checks from drivers/net/slip.c
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---
slip.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
--- linux-2.6.12-rc2-mm3-orig/drivers/net/slip.c 2005-03-02 08:38:33.000000000 +0100
+++ linux-2.6.12-rc2-mm3/drivers/net/slip.c 2005-04-11 23:10:06.000000000 +0200
@@ -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;
}
@@ -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
@@ -297,13 +294,10 @@ done_on_bh:
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net: remove redundant NULL pointer checks prior to kfree in drivers/net/slip.c
2005-04-11 21:15 [PATCH] net: remove redundant NULL pointer checks prior to kfree in drivers/net/slip.c Jesper Juhl
@ 2005-04-25 1:59 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-04-25 1:59 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel, loz, waltje, netdev
On Mon, 11 Apr 2005 23:15:40 +0200 (CEST)
Jesper Juhl <juhl-lkml@dif.dk> wrote:
> kfree() checks for NULL. Checking prior to calling it is redundant.
> This patch removes these redundant checks from drivers/net/slip.c
>
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Applied, thanks Jesper.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-04-25 2:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-11 21:15 [PATCH] net: remove redundant NULL pointer checks prior to kfree in drivers/net/slip.c Jesper Juhl
2005-04-25 1:59 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®