Commit 71324fdc authored by Andrew Jeffery's avatar Andrew Jeffery Committed by Linus Walleij

pinctrl: exynos5440: Use off-stack memory for pinctrl_gpio_range

The range is registered into a linked list which can be referenced
throughout the lifetime of the driver. Ensure the range's memory is useful
for the same lifetime by adding it to the driver's private data structure.

The bug was introduced in the driver's initial commit, which was present in
v3.10.

Fixes: f0b9a7e5 ("pinctrl: exynos5440: add pinctrl driver for Samsung EXYNOS5440 SoC")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAndrew Jeffery <andrew@aj.id.au>
Acked-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3024f920
...@@ -107,6 +107,7 @@ struct exynos5440_pmx_func { ...@@ -107,6 +107,7 @@ struct exynos5440_pmx_func {
* @nr_groups: number of pin groups available. * @nr_groups: number of pin groups available.
* @pmx_functions: list of pin functions parsed from device tree. * @pmx_functions: list of pin functions parsed from device tree.
* @nr_functions: number of pin functions available. * @nr_functions: number of pin functions available.
* @range: gpio range to register with pinctrl
*/ */
struct exynos5440_pinctrl_priv_data { struct exynos5440_pinctrl_priv_data {
void __iomem *reg_base; void __iomem *reg_base;
...@@ -117,6 +118,7 @@ struct exynos5440_pinctrl_priv_data { ...@@ -117,6 +118,7 @@ struct exynos5440_pinctrl_priv_data {
unsigned int nr_groups; unsigned int nr_groups;
const struct exynos5440_pmx_func *pmx_functions; const struct exynos5440_pmx_func *pmx_functions;
unsigned int nr_functions; unsigned int nr_functions;
struct pinctrl_gpio_range range;
}; };
/** /**
...@@ -742,7 +744,6 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, ...@@ -742,7 +744,6 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev,
struct pinctrl_desc *ctrldesc; struct pinctrl_desc *ctrldesc;
struct pinctrl_dev *pctl_dev; struct pinctrl_dev *pctl_dev;
struct pinctrl_pin_desc *pindesc, *pdesc; struct pinctrl_pin_desc *pindesc, *pdesc;
struct pinctrl_gpio_range grange;
char *pin_names; char *pin_names;
int pin, ret; int pin, ret;
...@@ -794,12 +795,12 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev, ...@@ -794,12 +795,12 @@ static int exynos5440_pinctrl_register(struct platform_device *pdev,
return PTR_ERR(pctl_dev); return PTR_ERR(pctl_dev);
} }
grange.name = "exynos5440-pctrl-gpio-range"; priv->range.name = "exynos5440-pctrl-gpio-range";
grange.id = 0; priv->range.id = 0;
grange.base = 0; priv->range.base = 0;
grange.npins = EXYNOS5440_MAX_PINS; priv->range.npins = EXYNOS5440_MAX_PINS;
grange.gc = priv->gc; priv->range.gc = priv->gc;
pinctrl_add_gpio_range(pctl_dev, &grange); pinctrl_add_gpio_range(pctl_dev, &priv->range);
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