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

pinctrl: equilibrium: Use temporary variable to hold pins

The pins are allocated from the heap, but in order to pass
them as constant object, we need to use non-constant pointer.
Achieve this by using a temporary variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231129161459.1002323-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
271e6a04 c82c0381

+6 -7
+6 -7
drivers/pinctrl/pinctrl-equilibrium.c
··· 704 704 { 705 705 struct device *dev = drvdata->dev; 706 706 struct device_node *node = dev->of_node; 707 - unsigned int *pinmux, pin_id, pinmux_id; 707 + unsigned int *pins, *pinmux, pin_id, pinmux_id; 708 708 struct group_desc group; 709 709 struct device_node *np; 710 710 struct property *prop; ··· 723 723 } 724 724 group.num_pins = err; 725 725 group.name = prop->value; 726 - group.pins = devm_kcalloc(dev, group.num_pins, 727 - sizeof(*(group.pins)), GFP_KERNEL); 728 - if (!group.pins) { 726 + pins = devm_kcalloc(dev, group.num_pins, sizeof(*pins), GFP_KERNEL); 727 + if (!pins) { 729 728 of_node_put(np); 730 729 return -ENOMEM; 731 730 } 731 + group.pins = pins; 732 732 733 - pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), 734 - GFP_KERNEL); 733 + pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), GFP_KERNEL); 735 734 if (!pinmux) { 736 735 of_node_put(np); 737 736 return -ENOMEM; ··· 749 750 of_node_put(np); 750 751 return -EINVAL; 751 752 } 752 - group.pins[j] = pin_id; 753 + pins[j] = pin_id; 753 754 if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) { 754 755 dev_err(dev, "Group %s: Read intel pinmux id failed\n", 755 756 group.name);