netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppp: remove redundant NULL pointer checks before kfree & vfree
@ 2005-04-28 22:54 Jesper Juhl
  2005-05-03 21:37 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2005-04-28 22:54 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-ppp, David S. Miller, netdev, linux-kernel

kfree() and vfree() can both deal with NULL pointers. This patch removes 
redundant NULL pointer checks from the ppp code in drivers/net/

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---

 drivers/net/ppp_deflate.c |    6 ++----
 drivers/net/ppp_generic.c |   12 ++++--------
 2 files changed, 6 insertions(+), 12 deletions(-)

--- linux-2.6.12-rc2-mm3-orig/drivers/net/ppp_deflate.c	2005-04-05 21:21:33.000000000 +0200
+++ linux-2.6.12-rc2-mm3/drivers/net/ppp_deflate.c	2005-04-29 00:44:26.000000000 +0200
@@ -87,8 +87,7 @@ static void z_comp_free(void *arg)
 
 	if (state) {
 		zlib_deflateEnd(&state->strm);
-		if (state->strm.workspace)
-			vfree(state->strm.workspace);
+		vfree(state->strm.workspace);
 		kfree(state);
 	}
 }
@@ -308,8 +307,7 @@ static void z_decomp_free(void *arg)
 
 	if (state) {
 		zlib_inflateEnd(&state->strm);
-		if (state->strm.workspace)
-			kfree(state->strm.workspace);
+		kfree(state->strm.workspace);
 		kfree(state);
 	}
 }
--- linux-2.6.12-rc2-mm3-orig/drivers/net/ppp_generic.c	2005-04-11 21:20:47.000000000 +0200
+++ linux-2.6.12-rc2-mm3/drivers/net/ppp_generic.c	2005-04-29 00:46:00.000000000 +0200
@@ -2510,14 +2510,10 @@ static void ppp_destroy_interface(struct
 	skb_queue_purge(&ppp->mrq);
 #endif /* CONFIG_PPP_MULTILINK */
 #ifdef CONFIG_PPP_FILTER
-	if (ppp->pass_filter) {
-		kfree(ppp->pass_filter);
-		ppp->pass_filter = NULL;
-	}
-	if (ppp->active_filter) {
-		kfree(ppp->active_filter);
-		ppp->active_filter = NULL;
-	}
+	kfree(ppp->pass_filter);
+	ppp->pass_filter = NULL;
+	kfree(ppp->active_filter);
+	ppp->active_filter = NULL;
 #endif /* CONFIG_PPP_FILTER */
 
 	kfree(ppp);





PS. Please CC me on replies.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ppp: remove redundant NULL pointer checks before kfree & vfree
  2005-04-28 22:54 [PATCH] ppp: remove redundant NULL pointer checks before kfree & vfree Jesper Juhl
@ 2005-05-03 21:37 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2005-05-03 21:37 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: paulus, linux-ppp, netdev, linux-kernel

On Fri, 29 Apr 2005 00:54:44 +0200 (CEST)
Jesper Juhl <juhl-lkml@dif.dk> wrote:

> kfree() and vfree() can both deal with NULL pointers. This patch removes 
> redundant NULL pointer checks from the ppp code in drivers/net/
> 
> 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-05-03 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-28 22:54 [PATCH] ppp: remove redundant NULL pointer checks before kfree & vfree Jesper Juhl
2005-05-03 21:37 ` 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;
as well as URLs for NNTP newsgroup(s).