| From 0af649d2eb1f04e5f64753cef6ce08f9c8b9f4b6 Mon Sep 17 00:00:00 2001 |
| From: Amelie Delaunay <amelie.delaunay@st.com> |
| Date: Fri, 4 Oct 2019 14:23:42 +0200 |
| Subject: [PATCH] pinctrl: stmfx: fix null pointer on remove |
| |
| commit 2fd215b8fdbe4d3a609adbe3a323696393cb1e53 upstream. |
| |
| dev_get_platdata(&pdev->dev) returns a pointer on struct stmfx_pinctrl, |
| not on struct stmfx (platform_set_drvdata(pdev, pctl); in probe). |
| Pointer on struct stmfx is stored in driver data of pdev parent (in probe: |
| struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);). |
| |
| Fixes: 1490d9f841b1 ("pinctrl: Add STMFX GPIO expander Pinctrl/GPIO driver") |
| Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> |
| Link: https://lore.kernel.org/r/20191004122342.22018-1-amelie.delaunay@st.com |
| Signed-off-by: Linus Walleij <linus.walleij@linaro.org> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c |
| index c82ad4b629e3..fe734135b0f2 100644 |
| --- a/drivers/pinctrl/pinctrl-stmfx.c |
| +++ b/drivers/pinctrl/pinctrl-stmfx.c |
| @@ -696,7 +696,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) |
| |
| static int stmfx_pinctrl_remove(struct platform_device *pdev) |
| { |
| - struct stmfx *stmfx = dev_get_platdata(&pdev->dev); |
| + struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent); |
| |
| return stmfx_function_disable(stmfx, |
| STMFX_FUNC_GPIO | |
| -- |
| 2.7.4 |
| |