mtd: cfi: remove unneeded NULL checks

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Feb 25 07:59:03 EST 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=17fabf156507ec0f688f1e58be02f38e04de0c6e
Commit:     17fabf156507ec0f688f1e58be02f38e04de0c6e
Parent:     b2d4fbab79bd2b121c56db757c3a0f06ec7e0868
Author:     Jiri Slaby <jslaby at suse.cz>
AuthorDate: Sun Jan 10 10:01:19 2010 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Feb 25 11:27:38 2010 +0000

    mtd: cfi: remove unneeded NULL checks
    
    In cfi_intelext_setup and cfi_amdstd_setup, mtd is never NULL.
    Remove unnecessary checks.
    
    Signed-off-by: Jiri Slaby <jslaby at suse.cz>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/chips/cfi_cmdset_0001.c |    6 ++----
 drivers/mtd/chips/cfi_cmdset_0002.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5fbf29e..9253043 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -615,10 +615,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
 	return mtd;
 
  setup_err:
-	if(mtd) {
-		kfree(mtd->eraseregions);
-		kfree(mtd);
-	}
+	kfree(mtd->eraseregions);
+	kfree(mtd);
 	kfree(cfi->cmdset_priv);
 	return NULL;
 }
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index f3600e8..1ebdcdd 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -494,10 +494,8 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
 	return mtd;
 
  setup_err:
-	if(mtd) {
-		kfree(mtd->eraseregions);
-		kfree(mtd);
-	}
+	kfree(mtd->eraseregions);
+	kfree(mtd);
 	kfree(cfi->cmdset_priv);
 	kfree(cfi->cfiq);
 	return NULL;



More information about the linux-mtd-cvs mailing list