aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2007-03-31 09:01:10 +0000
committerFlorian Fainelli <florian@openwrt.org>2007-03-31 09:01:10 +0000
commit806cd71e0a903222658db819b8acea2aebd588a1 (patch)
tree91fd31c652047d54b17c4309ac328fbf85301011 /target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
parent5720195886ebcabb2218e10d6ddc0aee66123bda (diff)
downloadupstream-806cd71e0a903222658db819b8acea2aebd588a1.tar.gz
upstream-806cd71e0a903222658db819b8acea2aebd588a1.tar.bz2
upstream-806cd71e0a903222658db819b8acea2aebd588a1.zip
Fix the division by zero (sn9)
SVN-Revision: 6770
Diffstat (limited to 'target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c')
-rw-r--r--target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c b/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
index 7a8193f023..f6a634a9ca 100644
--- a/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
+++ b/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
@@ -18,8 +18,8 @@
#ifndef RDC3210_STATIC_MAP
#define RDC3210_STATIC_MAP 0
#endif
-#ifndef RDC3210_NO_FACTORY_DFLT
-#define RDC3210_NO_FACTORY_DFLT 1
+#ifndef RDC3210_FACTORY_DFLT
+#define RDC3210_FACTORY_DFLT 0
#endif
#ifndef RDC3210_USING_JFFS2
#define RDC3210_USING_JFFS2 1
@@ -121,7 +121,7 @@ static struct mtd_partition rdc3210_parts[] =
{ name: "linux", offset: 0, size: 0x003C0000 }, /* 3840 KB = (Kernel + ROMFS) = (768 KB + 3072 KB) */
{ name: "romfs", offset: 0x000C0000, size: 0x00300000 }, /* 3072 KB */
{ name: "nvram", offset: 0x003C0000, size: 0x00010000 }, /* 64 KB */
-#if RDC3210_STATIC_MAP || !RDC3210_NO_FACTORY_DFLT
+#if RDC3210_STATIC_MAP || RDC3210_FACTORY_DFLT
{ name: "factory", offset: 0x003D0000, size: 0x00010000 }, /* 64 KB */
#endif
{ name: "bootldr", offset: 0x003E0000, size: 0x00020000 }, /* 128 KB */
@@ -173,6 +173,7 @@ mod_init_t init_rdc3210_map(void)
return -EIO;
}
+#if RDC3210_FACTORY_DFLT
/* 1. Adjust Redboot */
tmp = flashdrv_get_size() - rdc3210_parts[4].size;
rdc3210_parts[4].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));
@@ -195,7 +196,7 @@ mod_init_t init_rdc3210_map(void)
tmp = hdr->kernelsz + sizeof(gt_imghdr_t);
rdc3210_parts[1].offset = rdc3210_parts[0].offset + (((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2);
rdc3210_parts[1].size = rdc3210_parts[2].offset - rdc3210_parts[1].offset;
-#if RDC3210_NO_FACTORY_DFLT
+#else
/* 1. Adjust Redboot */
tmp = flashdrv_get_size() - rdc3210_parts[3].size;
rdc3210_parts[3].offset = flashdrv_get_sector_addr(flashdrv_get_sector(tmp));