android_kernel_xiaomi_sm8350/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
..
alchemy-flash.c
amd76xrom.c
autcpu12-nvram.c
bast-flash.c
cdb89712.c
ceiva.c
cfi_flagadm.c
ck804xrom.c
dbox2-flash.c
dc21285.c
dilnetpc.c
dmv182.c
ebony.c
edb7312.c
esb2rom.c
fortunet.c
h720x-flash.c
ichxrom.c
impa7.c
integrator-flash.c
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
ixp4xx.c
ixp2000.c
Kconfig [MTD] [MAPS] Remove Photron PNC-2000 map driver 2008-01-08 07:46:23 +00:00
l440gx.c
Makefile [MTD] [MAPS] Remove Photron PNC-2000 map driver 2008-01-08 07:46:23 +00:00
map_funcs.c
mbx860.c
mpc1211.c
mtx-1_flash.c Claim maintainership for block2mtd and update email addresses 2008-02-06 10:41:09 -08:00
netsc520.c
nettel.c
ocotea.c
octagon-5066.c
omap_nor.c
omap-toto-flash.c
pci.c
pcmciamtd.c
physmap_of.c [MTD] Factor out OF partition support from the NOR driver. 2008-02-03 18:06:48 +11:00
physmap.c mtd: maps/physmap: fix oops in suspend/resume/shutdown ops 2008-03-28 14:45:22 -07:00
plat-ram.c
pmcmsp-flash.c
pmcmsp-ramroot.c
pxa2xx-flash.c Reinstate lost flush_ioremap_region() fix to pxa2xx-flash driver 2007-10-15 12:55:20 -07:00
redwood.c
rpxlite.c
sa1100-flash.c
sbc8240.c
sbc_gxx.c
sc520cdp.c
scb2_flash.c [MTD] [NOR] Fix incorrect interface code for x16/x32 chips 2008-01-10 22:07:12 +00:00
scx200_docflash.c
sharpsl-flash.c
solutionengine.c
sun_uflash.c
tqm8xxl.c
ts5500_flash.c
tsunami_flash.c
uclinux.c
vmax301.c
walnut.c
wr_sbc82xx_flash.c