mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
mtd: rawnand: marvell: Fix probe error path
Ensure all chips are deregistered and cleaned in case of error during
the probe.
Fixes: 02f26ecf8c
("mtd: nand: add reworked Marvell NAND controller driver")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200424164501.26719-5-miquel.raynal@bootlin.com
This commit is contained in:
parent
7a0c18fb5c
commit
c525b7af96
1 changed files with 14 additions and 9 deletions
|
@ -2674,6 +2674,16 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc)
|
||||||
|
{
|
||||||
|
struct marvell_nand_chip *entry, *temp;
|
||||||
|
|
||||||
|
list_for_each_entry_safe(entry, temp, &nfc->chips, node) {
|
||||||
|
nand_release(&entry->chip);
|
||||||
|
list_del(&entry->node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
|
static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
|
||||||
{
|
{
|
||||||
struct device_node *np = dev->of_node;
|
struct device_node *np = dev->of_node;
|
||||||
|
@ -2708,21 +2718,16 @@ static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
|
||||||
ret = marvell_nand_chip_init(dev, nfc, nand_np);
|
ret = marvell_nand_chip_init(dev, nfc, nand_np);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
of_node_put(nand_np);
|
of_node_put(nand_np);
|
||||||
return ret;
|
goto cleanup_chips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc)
|
cleanup_chips:
|
||||||
{
|
marvell_nand_chips_cleanup(nfc);
|
||||||
struct marvell_nand_chip *entry, *temp;
|
|
||||||
|
|
||||||
list_for_each_entry_safe(entry, temp, &nfc->chips, node) {
|
return ret;
|
||||||
nand_release(&entry->chip);
|
|
||||||
list_del(&entry->node);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
|
static int marvell_nfc_init_dma(struct marvell_nfc *nfc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue