Skip to content

Commit 6170b43

Browse files
Russell KingThomas Gleixner
authored andcommitted
[MTD] Fix MTD device probing
Try larger numbers of chips before smaller numbers of chips across the bus width. This means we'll avoid misdetecting a 2 x16 array as 1 x32 if the high 16-bits happen to read as zeros in the QRY area. Signed-off-by: Russell King <linux@arm.linux.org.uk> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 3118db3 commit 6170b43

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/mtd/chips/gen_probe.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Routines common to all CFI-type probes.
33
* (C) 2001-2003 Red Hat, Inc.
44
* GPL'd
5-
* $Id: gen_probe.c,v 1.21 2004/08/14 15:14:05 dwmw2 Exp $
5+
* $Id: gen_probe.c,v 1.22 2005/01/24 23:49:50 rmk Exp $
66
*/
77

88
#include <linux/kernel.h>
@@ -162,7 +162,7 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp,
162162
int max_chips = map_bankwidth(map); /* And minimum 1 */
163163
int nr_chips, type;
164164

165-
for (nr_chips = min_chips; nr_chips <= max_chips; nr_chips <<= 1) {
165+
for (nr_chips = max_chips; nr_chips >= min_chips; nr_chips >>= 1) {
166166

167167
if (!cfi_interleave_supported(nr_chips))
168168
continue;

0 commit comments

Comments
 (0)