Commit 26ea8229 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

pinctrl: imx: 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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231129161459.1002323-6-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 271e6a04
...@@ -511,6 +511,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np, ...@@ -511,6 +511,7 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
{ {
const struct imx_pinctrl_soc_info *info = ipctl->info; const struct imx_pinctrl_soc_info *info = ipctl->info;
struct imx_pin *pin; struct imx_pin *pin;
unsigned int *pins;
int size, pin_size; int size, pin_size;
const __be32 *list; const __be32 *list;
int i; int i;
...@@ -557,20 +558,20 @@ static int imx_pinctrl_parse_groups(struct device_node *np, ...@@ -557,20 +558,20 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
grp->data = devm_kcalloc(ipctl->dev, grp->data = devm_kcalloc(ipctl->dev,
grp->num_pins, sizeof(struct imx_pin), grp->num_pins, sizeof(struct imx_pin),
GFP_KERNEL); GFP_KERNEL);
grp->pins = devm_kcalloc(ipctl->dev, if (!grp->data)
grp->num_pins, sizeof(unsigned int), return -ENOMEM;
GFP_KERNEL);
if (!grp->pins || !grp->data) pins = devm_kcalloc(ipctl->dev, grp->num_pins, sizeof(*pins), GFP_KERNEL);
if (!pins)
return -ENOMEM; return -ENOMEM;
grp->pins = pins;
for (i = 0; i < grp->num_pins; i++) { for (i = 0; i < grp->num_pins; i++) {
pin = &((struct imx_pin *)(grp->data))[i]; pin = &((struct imx_pin *)(grp->data))[i];
if (info->flags & IMX_USE_SCU) if (info->flags & IMX_USE_SCU)
info->imx_pinctrl_parse_pin(ipctl, &grp->pins[i], info->imx_pinctrl_parse_pin(ipctl, &pins[i], pin, &list);
pin, &list);
else else
imx_pinctrl_parse_pin_mmio(ipctl, &grp->pins[i], imx_pinctrl_parse_pin_mmio(ipctl, &pins[i], pin, &list, np);
pin, &list, np);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment