[PATCH] mtd:Remove unnessary BUG function calls in nand_scan_tail

Nicholas Krause xerofoify at gmail.com
Sat May 2 08:10:13 PDT 2015


This removes all unnessary calls to BUG() below pr_warn print messages
as these printed messages are verbose enough for debugging if these
scenarios are hit in the function,nand_scan_tail.

Signed-off-by: Nicholas Krause <xerofoify at gmail.com>
---
 drivers/mtd/nand/nand_base.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c2e1232..6a5bc99 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3949,7 +3949,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 		default:
 			pr_warn("No oob scheme defined for oobsize %d\n",
 				   mtd->oobsize);
-			BUG();
 		}
 	}
 
@@ -3966,7 +3965,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 		/* Similar to NAND_ECC_HW, but a separate read_page handle */
 		if (!ecc->calculate || !ecc->correct || !ecc->hwctl) {
 			pr_warn("No ECC functions supplied; hardware ECC not possible\n");
-			BUG();
 		}
 		if (!ecc->read_page)
 			ecc->read_page = nand_read_page_hwecc_oob_first;
@@ -3997,7 +3995,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 		     !ecc->write_page ||
 		     ecc->write_page == nand_write_page_hwecc)) {
 			pr_warn("No ECC functions supplied; hardware ECC not possible\n");
-			BUG();
 		}
 		/* Use standard syndrome read/write page function? */
 		if (!ecc->read_page)
@@ -4016,7 +4013,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 		if (mtd->writesize >= ecc->size) {
 			if (!ecc->strength) {
 				pr_warn("Driver must set ecc.strength when using hardware ECC\n");
-				BUG();
 			}
 			break;
 		}
@@ -4043,7 +4039,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 	case NAND_ECC_SOFT_BCH:
 		if (!mtd_nand_has_bch()) {
 			pr_warn("CONFIG_MTD_NAND_ECC_BCH not enabled\n");
-			BUG();
 		}
 		ecc->calculate = nand_bch_calculate_ecc;
 		ecc->correct = nand_bch_correct_data;
@@ -4071,7 +4066,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 					       &ecc->layout);
 		if (!ecc->priv) {
 			pr_warn("BCH ECC initialization failed!\n");
-			BUG();
 		}
 		break;
 
@@ -4090,7 +4084,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 
 	default:
 		pr_warn("Invalid NAND_ECC_MODE %d\n", ecc->mode);
-		BUG();
 	}
 
 	/* For many systems, the standard OOB write also works for raw */
@@ -4121,7 +4114,6 @@ int nand_scan_tail(struct mtd_info *mtd)
 	ecc->steps = mtd->writesize / ecc->size;
 	if (ecc->steps * ecc->size != mtd->writesize) {
 		pr_warn("Invalid ECC parameters\n");
-		BUG();
 	}
 	ecc->total = ecc->steps * ecc->bytes;
 
-- 
2.1.4




More information about the linux-mtd mailing list