[PATCH] vfree() cleanup in drivers/net/bsd_comp.c

From: Jesper Juhl
Date: Wed Jun 29 2005 - 17:43:08 EST


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@xxxxxxxxx>
---

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);
}
}

/*



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/