Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: core: Don't use devres functions before device is added

The supply aliases for the MFD devices were being added using devres but
the device hasn't been added at this point and as such we can't use
devres.

The MFD already has a function that removes devices this patch uses the
non-devres versions of the supply alias functions and adds an unregister
in mfd_remove_devices_fn.

Reported-by: Carlo Caione <carlo@caione.org>
Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Charles Keepax and committed by
Lee Jones
d137be00 1ec93b9b

+7 -4
+7 -4
drivers/mfd/mfd-core.c
··· 102 102 pdev->dev.dma_mask = parent->dma_mask; 103 103 pdev->dev.dma_parms = parent->dma_parms; 104 104 105 - ret = devm_regulator_bulk_register_supply_alias( 105 + ret = regulator_bulk_register_supply_alias( 106 106 &pdev->dev, cell->parent_supplies, 107 107 parent, cell->parent_supplies, 108 108 cell->num_parent_supplies); ··· 182 182 return 0; 183 183 184 184 fail_alias: 185 - devm_regulator_bulk_unregister_supply_alias(&pdev->dev, 186 - cell->parent_supplies, 187 - cell->num_parent_supplies); 185 + regulator_bulk_unregister_supply_alias(&pdev->dev, 186 + cell->parent_supplies, 187 + cell->num_parent_supplies); 188 188 fail_res: 189 189 kfree(res); 190 190 fail_device: ··· 237 237 238 238 pdev = to_platform_device(dev); 239 239 cell = mfd_get_cell(pdev); 240 + 241 + regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies, 242 + cell->num_parent_supplies); 240 243 241 244 /* find the base address of usage_count pointers (for freeing) */ 242 245 if (!*usage_count || (cell->usage_count < *usage_count))