Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/nand Add assertions and remove bogus ctassert.
details: https://anonhg.NetBSD.org/src/rev/eb2ad094d245
branches: trunk
changeset: 782434:eb2ad094d245
user: ahoka <ahoka%NetBSD.org@localhost>
date: Fri Nov 02 21:17:26 2012 +0000
description:
Add assertions and remove bogus ctassert.
diffstat:
sys/dev/nand/nand_samsung.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (82 lines):
diff -r 3520e35b54e1 -r eb2ad094d245 sys/dev/nand/nand_samsung.c
--- a/sys/dev/nand/nand_samsung.c Fri Nov 02 21:07:07 2012 +0000
+++ b/sys/dev/nand/nand_samsung.c Fri Nov 02 21:17:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nand_samsung.c,v 1.5 2012/11/02 20:55:01 ahoka Exp $ */
+/* $NetBSD: nand_samsung.c,v 1.6 2012/11/02 21:17:26 ahoka Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nand_samsung.c,v 1.5 2012/11/02 20:55:01 ahoka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nand_samsung.c,v 1.6 2012/11/02 21:17:26 ahoka Exp $");
#include "nand.h"
#include "onfi.h"
@@ -54,9 +54,6 @@
NAND_SAMSUNG_PLANESIZEMASK = 0x7 << 4
};
-CTASSERT(NAND_SAMSUNG_PAGEMASK | NAND_SAMSUNG_SPAREMASK
- | NAND_SAMSUNG_BLOCKMASK | NAND_SAMSUNG_BITSMASK == 0xff);
-
int
nand_read_parameters_samsung(device_t self, struct nand_chip * const chip)
{
@@ -104,6 +101,8 @@
case 0x3:
chip->nc_page_size = 8192;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
switch ((params2 & NAND_SAMSUNG_BLOCKMASK) >> 4) {
@@ -119,6 +118,8 @@
case 0x3:
chip->nc_block_size = 512 * 1024;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
/* 8/16 bytes per 512 bytes! XXX do i get this right? */
@@ -129,6 +130,8 @@
case 0x1:
chip->nc_spare_size = 16 * chip->nc_page_size / 512;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
switch ((params2 & NAND_SAMSUNG_BITSMASK) >> 6) {
@@ -138,6 +141,8 @@
case 0x1:
chip->nc_flags |= NC_BUSWIDTH_16;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
switch ((params3 & NAND_SAMSUNG_PLANENUMMASK) >> 2) {
@@ -153,6 +158,8 @@
case 0x3:
chip->nc_num_luns = 8;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
uint64_t planesize = 0;
@@ -181,6 +188,8 @@
case 0x7:
planesize = 8ul * 1024 * 1024 * 1024;
break;
+ default:
+ KASSERTMSG(false, "ID Data parsing bug detected!");
}
chip->nc_lun_blocks = planesize / chip->nc_block_size;
Home |
Main Index |
Thread Index |
Old Index