linux/drivers/mtd/maps
Anton Vorontsov 4a5691c0f7 mtd: maps/physmap: fix oops in suspend/resume/shutdown ops
# reboot
...
[   42.351266] Flash device refused suspend due to active operation (state 0)
[   42.358195] Unable to handle kernel NULL pointer dereference at virtual address 00000078
[   42.360060] pgd = c7d9c000
[   42.362769] [00000078] *pgd=a7d8d031, *pte=00000000, *ppte=00000000
[   42.372902] Internal error: Oops: 17 [#1]
[   42.376911] Modules linked in:
[   42.379980] CPU: 0    Not tainted  (2.6.25-rc2-10642-ge8f2594-dirty #73)
[   42.380000] PC is at physmap_flash_shutdown+0x28/0x54
...
[   42.380000] Backtrace:
[   42.380000] [<c0130c1c>] (physmap_flash_shutdown+0x0/0x54) from [<c01207c0>] (platform_drv_shutdown+0x20/0x24)
[   42.380000]  r5:28121969 r4:c0229e08
[   42.380000] [<c01207a0>] (platform_drv_shutdown+0x0/0x24) from [<c011cd40>] (device_shutdown+0x60/0x88)
[   42.380000] [<c011cce0>] (device_shutdown+0x0/0x88) from [<c003e8a4>] (kernel_restart_prepare+0x2c/0x3c)
[   42.380000]  r4:00000000
[   42.380000] [<c003e878>] (kernel_restart_prepare+0x0/0x3c) from [<c003ea00>] (kernel_restart+0x14/0x48)
[   42.380000] [<c003e9ec>] (kernel_restart+0x0/0x48) from [<c003fdc0>] (sys_reboot+0xe8/0x1f8)
[   42.380000]  r4:01234567
[   42.380000] [<c003fcd8>] (sys_reboot+0x0/0x1f8) from [<c001aa00>] (ret_fast_syscall+0x0/0x2c)
[   42.380000]  r7:00000058 r6:00000004 r5:00000001 r4:00000000
[   42.380000] Code: 0a000009 e7953004 e1a00003 e1a0e00f (e593f078)
[   42.650051] ---[ end trace 6d6c26a0fc3141de ]---
Segmentation fault
INIT: no more processes left in this runlevel

While looping for mtd[i]s, we should stop at the mtd[i] == NULL.

This patch also removes unnecessary "if (info)" checks:
suspend/resume/shutdown ops are executed only if probe() is succeeded, so info
is guaranteed to be !NULL.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-28 14:45:22 -07:00
..
Kconfig [MTD] [MAPS] Remove Photron PNC-2000 map driver 2008-01-08 07:46:23 +00:00
Makefile [MTD] [MAPS] Remove Photron PNC-2000 map driver 2008-01-08 07:46:23 +00:00
alchemy-flash.c [MTD] Remove useless references to MIPS_HYDROGEN3 and MIPS_MIRAGE_WHY. 2007-07-23 12:50:51 +01:00
amd76xrom.c [MTD] [MAPS] amd76xrom warning fix 2007-02-18 16:42:25 +00:00
autcpu12-nvram.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
bast-flash.c [MTD] Remove trailing whitespace 2006-11-30 08:17:38 +00:00
cdb89712.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
ceiva.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
cfi_flagadm.c Fix typos in doc and comments 2006-11-30 05:32:19 +01:00
ck804xrom.c [MTD] [MAPS] drivers/mtd/maps/ck804xrom.c: convert pci_module_init() 2007-04-27 23:34:21 +01:00
dbox2-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
dc21285.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
dilnetpc.c [MTD] [MAPS] dilnetpc: Fix printk warning 2007-03-08 09:46:28 +00:00
dmv182.c fix file specification in comments 2006-10-03 23:01:26 +02:00
ebony.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
edb7312.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
esb2rom.c [MTD] ESB2 check for closed ROM window 2007-03-08 09:21:42 +00:00
fortunet.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
h720x-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ichxrom.c [MTD] [MAPS] ichxrom warning fix 2007-02-18 16:42:51 +00:00
impa7.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
integrator-flash.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
intel_vr_nor.c [MTD] map driver for NOR flash on the Intel Vermilion Range chipset 2007-09-23 18:51:25 +01:00
ipaq-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
ixp4xx.c [MTD] Fix ixp4xx partition parsing. 2006-09-22 10:16:16 +01:00
ixp2000.c [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver 2006-06-27 14:36:20 +01:00
l440gx.c [MTD] Switch to pci_get_device and do ref counting 2006-09-22 10:19:20 +01:00
map_funcs.c [MTD] XIP for AMD CFI flash. 2005-06-29 14:18:40 +02:00
mbx860.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
mpc1211.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mtx-1_flash.c Claim maintainership for block2mtd and update email addresses 2008-02-06 10:41:09 -08:00
netsc520.c [MTD] [MAPS] netsc520 warning fix 2007-02-18 16:41:31 +00:00
nettel.c [MTD] [MAPS] Cleanup nettel map driver 2007-06-28 23:02:59 +01:00
ocotea.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
octagon-5066.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
omap-toto-flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
omap_nor.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
pci.c [PATCH] Dead code in mtd/maps/pci.c 2006-03-31 12:18:49 -08:00
pcmciamtd.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
physmap.c mtd: maps/physmap: fix oops in suspend/resume/shutdown ops 2008-03-28 14:45:22 -07:00
physmap_of.c [MTD] Factor out OF partition support from the NOR driver. 2008-02-03 18:06:48 +11:00
plat-ram.c [MTD] [MAPS] fix plat-ram printk format 2007-04-26 07:28:58 +01:00
pmcmsp-flash.c [MTD] pmcmsp-flash.c: kmalloc + memset conversion to k[cz]alloc 2007-08-01 11:03:35 +01:00
pmcmsp-ramroot.c [MTD] Remove references to ROOT_DEV from map drivers. 2007-06-28 20:13:27 +01:00
pxa2xx-flash.c Reinstate lost flush_ioremap_region() fix to pxa2xx-flash driver 2007-10-15 12:55:20 -07:00
redwood.c [MTD] Cleanup of 'ioremap balanced with iounmap for drivers/mtd subsystem' 2006-10-02 09:48:23 +01:00
rpxlite.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sa1100-flash.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
sbc8240.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
sbc_gxx.c [MTD] maps: Clean up trailing white spaces 2005-11-07 15:01:58 +01:00
sc520cdp.c [MTD] [MAPS] sc520cdp warning fix 2007-02-18 16:41:01 +00:00
scb2_flash.c [MTD] [NOR] Fix incorrect interface code for x16/x32 chips 2008-01-10 22:07:12 +00:00
scx200_docflash.c [MTD] Switch to pci_get_device and do ref counting 2006-09-22 10:19:20 +01:00
sharpsl-flash.c [PATCH] drivers/mtd: Use ARRAY_SIZE macro 2006-03-31 12:18:48 -08:00
solutionengine.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sun_uflash.c [SPARC/64] constify of_get_property return: drivers 2007-04-26 01:54:27 -07:00
tqm8xxl.c [MTD] replace kmalloc+memset with kzalloc 2006-11-28 23:47:21 +00:00
ts5500_flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
tsunami_flash.c [PATCH] tsunami_flash: fix "parse error before ';' token" 2006-02-01 08:53:10 -08:00
uclinux.c [MTD] [MAPS] don't force uclinux mtd map to be root dev 2007-05-11 11:48:15 +01:00
vmax301.c [PATCH] drivers/mtd/maps/vmax301.c: fix off by one vmax_mtd 2006-03-31 12:18:49 -08:00
walnut.c ioremap balanced with iounmap for drivers/mtd subsystem 2006-09-22 10:24:31 +01:00
wr_sbc82xx_flash.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00