| From: |
| Jesper Juhl <juhl-lkml@dif.dk> |
| To: |
| Andrew Morton <akpm@osdl.org> |
| Subject: |
| [PATCH] vfree() cleanup in drivers/net/bsd_comp.c |
| Date: |
| Thu, 30 Jun 2005 00:43:36 +0200 (CEST) |
| Cc: |
| linux-kernel <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
"David S. Miller" <davem@davemloft.net> |
You can pass NULL pointers to vfree() just fine. There's no bennefit in
checking first if the pointer is != NULL.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/net/bsd_comp.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
--- linux-2.6.13-rc1-orig/drivers/net/bsd_comp.c 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.13-rc1/drivers/net/bsd_comp.c 2005-06-30 00:38:32.000000000 +0200
@@ -46,13 +46,13 @@
/*
* This version is for use with contiguous buffers on Linux-derived systems.
*
- * ==FILEVERSION 20000226==
+ * ==FILEVERSION 20050630==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, please set the number above to the
- * date of the modification as YYMMDD (year month day).
+ * date of the modification as YYYYMMDD (year month day).
* bsd_comp.c is shipped with a PPP distribution as well as with
* the kernel; if everyone increases the FILEVERSION number above,
* then scripts can do the right thing when deciding whether to
* install a new bsd_comp.c file. Don't change the format of that
@@ -330,25 +330,19 @@ static void bsd_free (void *state)
{
/*
* Release the dictionary
*/
- if (db->dict)
- {
- vfree (db->dict);
- db->dict = NULL;
- }
+ vfree(db->dict);
+ db->dict = NULL;
/*
* Release the string buffer
*/
- if (db->lens)
- {
- vfree (db->lens);
- db->lens = NULL;
- }
+ vfree(db->lens);
+ db->lens = NULL;
/*
* Finally release the structure itself.
*/
- kfree (db);
+ kfree(db);
}
}
/*