Patchwork [3/5] mtd: chips/cfi, remove unneeded NULL checks

login
register
mail settings
Submitter Andrew Morton
Date Feb. 2, 2010, 10:43 p.m.
Message ID <201002022243.o12MhAST019182@imap1.linux-foundation.org>
Download mbox | patch
Permalink /patch/44322/
State New
Headers show

Comments

Andrew Morton - Feb. 2, 2010, 10:43 p.m.
From: Jiri Slaby <jslaby@suse.cz>

In cfi_intelext_setup and cfi_amdstd_setup, mtd is never NULL.  Remove
unnecessary checks.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mtd/chips/cfi_cmdset_0001.c |    6 ++----
 drivers/mtd/chips/cfi_cmdset_0002.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

Patch

diff -puN drivers/mtd/chips/cfi_cmdset_0001.c~mtd-chips-cfi-remove-unneeded-null-checks drivers/mtd/chips/cfi_cmdset_0001.c
--- a/drivers/mtd/chips/cfi_cmdset_0001.c~mtd-chips-cfi-remove-unneeded-null-checks
+++ a/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -615,10 +615,8 @@  static struct mtd_info *cfi_intelext_set
 	return mtd;
 
  setup_err:
-	if(mtd) {
-		kfree(mtd->eraseregions);
-		kfree(mtd);
-	}
+	kfree(mtd->eraseregions);
+	kfree(mtd);
 	kfree(cfi->cmdset_priv);
 	return NULL;
 }
diff -puN drivers/mtd/chips/cfi_cmdset_0002.c~mtd-chips-cfi-remove-unneeded-null-checks drivers/mtd/chips/cfi_cmdset_0002.c
--- a/drivers/mtd/chips/cfi_cmdset_0002.c~mtd-chips-cfi-remove-unneeded-null-checks
+++ a/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -494,10 +494,8 @@  static struct mtd_info *cfi_amdstd_setup
 	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;