diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-28 10:15:33 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-28 10:15:33 -0700 |
commit | 3a7c327767221660e9e9a62e5538173873193f0a (patch) | |
tree | 034522d3182ed083604d0c8a34f853887cb468f7 /drivers | |
parent | 5ec06b5c0d259a8c7c4376b121b2f62dfbfe57ef (diff) | |
parent | 22380b65dc70f5b132c5afdf6b4011e2a84ec34a (diff) | |
download | linux-3a7c327767221660e9e9a62e5538173873193f0a.tar.bz2 |
Merge tag 'mfd-fixes-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD fixes from Lee Jones:
- fix double free
- handle devicetree disabled devices gracefully
* tag 'mfd-fixes-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
mfd: mfd-core: Ensure disabled devices are ignored without error
mfd: core: Fix double-free in mfd_remove_devices_fn()
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/mfd-core.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index c3651f06684f..fc00aaccb5f7 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -126,10 +126,6 @@ static int mfd_match_of_node_to_dev(struct platform_device *pdev, const __be32 *reg; u64 of_node_addr; - /* Skip devices 'disabled' by Device Tree */ - if (!of_device_is_available(np)) - return -ENODEV; - /* Skip if OF node has previously been allocated to a device */ list_for_each_entry(of_entry, &mfd_of_node_list, list) if (of_entry->np == np) @@ -212,6 +208,12 @@ static int mfd_add_device(struct device *parent, int id, if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { if (of_device_is_compatible(np, cell->of_compatible)) { + /* Ignore 'disabled' devices error free */ + if (!of_device_is_available(np)) { + ret = 0; + goto fail_alias; + } + ret = mfd_match_of_node_to_dev(pdev, np, cell); if (ret == -EAGAIN) continue; @@ -370,8 +372,6 @@ static int mfd_remove_devices_fn(struct device *dev, void *data) regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies, cell->num_parent_supplies); - kfree(cell); - platform_device_unregister(pdev); return 0; } |