diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-01-13 20:14:15 -0200 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2015-01-20 12:37:57 -0800 |
commit | cfe4af3aac3bd63e9caf548157805ca46ad7b073 (patch) | |
tree | 8432c64db6f009425799a7e09c22b2321a1b12c9 /drivers/mtd/nand | |
parent | fcc87a95195236b0935183361a72e4a98bf577d8 (diff) | |
download | linux-cfe4af3aac3bd63e9caf548157805ca46ad7b073.tar.bz2 |
mtd: fsl-quadspi: Fix module unbound
When removing the fsl-quadspi module and running 'cat /proc/mtd' afterwards,
we see garbage data like:
$ rmmod fsl-quadspi
$ cat /proc/mtd
dev: size erasesize name
mtd0: 00000000 00000000 "(null)"
mtd0: 00000000 00000000 "(null)"
mtd0: 00000000 00000000 "(null)"
...
mtd0: a22296c6c756e28 00000000 "(null)"
mtd0: a22296c6c756e28 3064746d "(null)"
If we continue doing multiple module load/unload operations, then it will also
lead to a kernel crash.
The reason for this is due to the wrong mtd index used in
mtd_device_unregister() in the remove function.
We need to keep the mtd unregister index aligned with the one used in the probe
function, which means we need to take into account the 'has_second_chip'
property. By doing so we can guarantee that the mtd index is the same in the
registration and unregistration functions.
With this patch applied we can load/unload the fsl-quadspi driver several times
and it will result in no crash.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Huang Shijie <shijie.huang@intel.com>
Tested-by: Frank Li <Frank.Li@freescale.com>
Acked-by: Allen Xu <han.xu@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand')
0 files changed, 0 insertions, 0 deletions