]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: initialize ntargets with maxchips
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 21 May 2019 08:43:35 +0000 (10:43 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 21 May 2019 09:50:49 +0000 (11:50 +0200)
commit6340d142025218f04205b635abd4dfdac6ec86f4
treeca48b60c0a47419d0690aba5e05c6ce8ce1c1361
parent49250288820449e26abffc1305ba221bd05ce90d
mtd: rawnand: initialize ntargets with maxchips

memorg->ntargets is initialized with '1'. It should be initialized with
the maxchips argument from nand_scan() instead. Otherwise multi chip
support errors out on the secondary chip selects when trying to call
nand_reset() on them:

WARNING: CPU: 0 PID: 1 at drivers/mtd/nand/raw/internals.h:114
nand_reset_op+0x194/0x1c4

With this memorg->ntargets is initialized with the maximum number of
chip selects supported by the driver. After having detected the number
of actually connected chips memory->ntargets is updated with that
number.

Fixes: b7903792b9ad ("mtd: rawnand: Get rid of chip->numchips")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/nand_base.c