[PATCH] Do not oops when configured flash size is less then chip size
David Vrabel
dvrabel at arcom.com
Thu May 11 11:52:54 EDT 2006
Leon Woestenberg wrote:
>
> [MTD] CHIPS: Do not oops when configured flash size is less then chip size
>
> My kernel oopsed when the on-board flash chips where quadruple the size of the
> platform default physmap_map.size. Turned out that max_chips becomes zero,
> resulting in an oops later in locking chip->mutex being non-initialized.
> --- a/drivers/mtd/chips/gen_probe.c
> +++ b/drivers/mtd/chips/gen_probe.c
> @@ -100,6 +100,11 @@ #endif
> * Align bitmap storage size to full byte.
> */
> max_chips = map->size >> cfi.chipshift;
> + if (max_chips == 0) {
> + printk(KERN_WARNING "Single flash chip size exceeds the configured flash area size. Check your kernel configuration.\n");
This sounds like a valid, if unlikely, board configuration. e.g., a
board with chips fitted that are larger than the chip-select memory window.
It might be better to pretend such configuration is a single chip that's
smaller than it physically is.
Maybe something as simple as:
/* there's at least one chip present */
max_chips = max(map->size >> cfi.chipshift, 1);
?
David Vrabel
--
David Vrabel, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
More information about the linux-mtd
mailing list