[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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Jesper Juhl 2005-09-10 00:26:54 -07:00 • committed by Linus Torvalds
commit f9101210e7
20 changed files with 86 additions and 142 deletions

View file

@ -91,8 +91,7 @@ static void __exit cleanup_mtdram(void)
{
if (mtd_info) {
del_mtd_device(mtd_info);
if (mtd_info->priv)
vfree(mtd_info->priv);
vfree(mtd_info->priv);
kfree(mtd_info);
}
}

View file

@ -1017,27 +1017,16 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev,
void ftl_freepart(partition_t *part)
{
if (part->VirtualBlockMap) {
vfree(part->VirtualBlockMap);
part->VirtualBlockMap = NULL;
}
if (part->VirtualPageMap) {
kfree(part->VirtualPageMap);
part->VirtualPageMap = NULL;
}
if (part->EUNInfo) {
kfree(part->EUNInfo);
part->EUNInfo = NULL;
}
if (part->XferInfo) {
kfree(part->XferInfo);
part->XferInfo = NULL;
}
if (part->bam_cache) {
kfree(part->bam_cache);
part->bam_cache = NULL;
}
} /* ftl_freepart */
static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)