diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-09-10 03:26:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-10 13:06:30 -0400 |
commit | f9101210e7aa72daf92722d451a2f7e3af5f781f (patch) | |
tree | 9554007e19387f2d05352ab03332be50c5b95f5b /drivers/mtd | |
parent | 887c27f369abc458556a5ce8ab22ddd498474307 (diff) |
[PATCH] vfree and kfree cleanup in drivers/
This patch does a full cleanup of 'NULL checks before vfree', and a partial
cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in
that I only did the files that also had vfree calls in them. The patch
also gets rid of some redundant (void *) casts of pointers being passed to
[vk]free, and a some tiny whitespace corrections also crept in.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/mtdram.c | 3 | ||||
-rw-r--r-- | drivers/mtd/ftl.c | 11 |
2 files changed, 1 insertions, 13 deletions
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index bb713fed2f37..1443117fd8f4 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c | |||
@@ -91,8 +91,7 @@ static void __exit cleanup_mtdram(void) | |||
91 | { | 91 | { |
92 | if (mtd_info) { | 92 | if (mtd_info) { |
93 | del_mtd_device(mtd_info); | 93 | del_mtd_device(mtd_info); |
94 | if (mtd_info->priv) | 94 | vfree(mtd_info->priv); |
95 | vfree(mtd_info->priv); | ||
96 | kfree(mtd_info); | 95 | kfree(mtd_info); |
97 | } | 96 | } |
98 | } | 97 | } |
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index d9ab60b36fd4..d32c1b3a8ce3 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -1017,27 +1017,16 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev, | |||
1017 | 1017 | ||
1018 | void ftl_freepart(partition_t *part) | 1018 | void ftl_freepart(partition_t *part) |
1019 | { | 1019 | { |
1020 | if (part->VirtualBlockMap) { | ||
1021 | vfree(part->VirtualBlockMap); | 1020 | vfree(part->VirtualBlockMap); |
1022 | part->VirtualBlockMap = NULL; | 1021 | part->VirtualBlockMap = NULL; |
1023 | } | ||
1024 | if (part->VirtualPageMap) { | ||
1025 | kfree(part->VirtualPageMap); | 1022 | kfree(part->VirtualPageMap); |
1026 | part->VirtualPageMap = NULL; | 1023 | part->VirtualPageMap = NULL; |
1027 | } | ||
1028 | if (part->EUNInfo) { | ||
1029 | kfree(part->EUNInfo); | 1024 | kfree(part->EUNInfo); |
1030 | part->EUNInfo = NULL; | 1025 | part->EUNInfo = NULL; |
1031 | } | ||
1032 | if (part->XferInfo) { | ||
1033 | kfree(part->XferInfo); | 1026 | kfree(part->XferInfo); |
1034 | part->XferInfo = NULL; | 1027 | part->XferInfo = NULL; |
1035 | } | ||
1036 | if (part->bam_cache) { | ||
1037 | kfree(part->bam_cache); | 1028 | kfree(part->bam_cache); |
1038 | part->bam_cache = NULL; | 1029 | part->bam_cache = NULL; |
1039 | } | ||
1040 | |||
1041 | } /* ftl_freepart */ | 1030 | } /* ftl_freepart */ |
1042 | 1031 | ||
1043 | static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | 1032 | static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) |