summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinmux.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-05-12 11:47:57 -0400
committerLinus Walleij <linus.walleij@linaro.org>2017-05-22 11:36:13 -0400
commit664b7c4728821767e0228ee161bab87db2be58f1 (patch)
tree8b8d6507cbdd45754772a91f4b612bd171ad6d4a /drivers/pinctrl/pinmux.c
parent020e0b1c8f19f1fc3bce23beeccd80c574ca0e49 (diff)
pinctrl: core: Fix warning by removing bogus code
Andre Przywara <andre.przywara@arm.com> noticed that we can get the following warning with -EPROBE_DEFER: "WARNING: CPU: 1 PID: 89 at drivers/base/dd.c:349 driver_probe_device+0x2ac/0x2e8" Let's fix the issue by removing the indices as suggested by Tejun Heo <tj@kernel.org>. All we have to do here is kill the radix tree. I probably ended up with the indices after grepping for removal of all entries using radix_tree_for_each_slot() and the first match found was gmap_radix_tree_free(). Anyways, no need for indices here, and we can just do remove all the entries using radix_tree_for_each_slot() along how the item_kill_tree() test case does. Fixes: c7059c5ac70a ("pinctrl: core: Add generic pinctrl functions for managing groups") Fixes: a76edc89b100 ("pinctrl: core: Add generic pinctrl functions for managing groups") Reported-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r--drivers/pinctrl/pinmux.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 9fd6d9087dc5..16b3ae5e4f44 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -826,30 +826,17 @@ EXPORT_SYMBOL_GPL(pinmux_generic_remove_function);
826 * pinmux_generic_free_functions() - removes all functions 826 * pinmux_generic_free_functions() - removes all functions
827 * @pctldev: pin controller device 827 * @pctldev: pin controller device
828 * 828 *
829 * Note that the caller must take care of locking. 829 * Note that the caller must take care of locking. The pinctrl
830 * functions are allocated with devm_kzalloc() so no need to free
831 * them here.
830 */ 832 */
831void pinmux_generic_free_functions(struct pinctrl_dev *pctldev) 833void pinmux_generic_free_functions(struct pinctrl_dev *pctldev)
832{ 834{
833 struct radix_tree_iter iter; 835 struct radix_tree_iter iter;
834 struct function_desc *function;
835 unsigned long *indices;
836 void **slot; 836 void **slot;
837 int i = 0;
838
839 indices = devm_kzalloc(pctldev->dev, sizeof(*indices) *
840 pctldev->num_functions, GFP_KERNEL);
841 if (!indices)
842 return;
843 837
844 radix_tree_for_each_slot(slot, &pctldev->pin_function_tree, &iter, 0) 838 radix_tree_for_each_slot(slot, &pctldev->pin_function_tree, &iter, 0)
845 indices[i++] = iter.index; 839 radix_tree_delete(&pctldev->pin_function_tree, iter.index);
846
847 for (i = 0; i < pctldev->num_functions; i++) {
848 function = radix_tree_lookup(&pctldev->pin_function_tree,
849 indices[i]);
850 radix_tree_delete(&pctldev->pin_function_tree, indices[i]);
851 devm_kfree(pctldev->dev, function);
852 }
853 840
854 pctldev->num_functions = 0; 841 pctldev->num_functions = 0;
855} 842}