diff options
author | Luo Jiaxing <luojiaxing@huawei.com> | 2020-11-27 09:50:02 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2020-12-02 10:40:54 +0100 |
commit | 60593df667e087b009ee0fc20d92e9c4c096a9b5 (patch) | |
tree | a1b4ba5bc78c49431c24331be686c461116c9394 /drivers/gpio/gpio-dwapb.c | |
parent | gpio: arizona: disable pm_runtime in case of failure (diff) | |
download | linux-60593df667e087b009ee0fc20d92e9c4c096a9b5.tar.xz linux-60593df667e087b009ee0fc20d92e9c4c096a9b5.zip |
gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend()
Following Calltrace is found when running echo freeze > /sys/power/state.
[ 272.755506] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
[ 272.755585] Call trace:
[ 272.755587] dwapb_gpio_suspend+0x18/0x318
[ 272.755588] pm_generic_suspend+0x2c/0x48
[ 272.755595] acpi_subsys_suspend+0x60/0x70
[ 272.755599] dpm_run_callback.isra.18+0x40/0xe0
[ 272.755601] __device_suspend+0xf4/0x360
The reason is platform_set_drvdata() is deleted, and dwapb_gpio_suspend()
get *gpio by dev_get_drvdata().
Fixes: feeaefd378ca ("gpio: dwapb: Use resource managed GPIO-chip add data method")
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpio/gpio-dwapb.c')
-rw-r--r-- | drivers/gpio/gpio-dwapb.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 2a9046c0fb16..4275c18a097a 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -724,6 +724,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev) return err; } + platform_set_drvdata(pdev, gpio); + return 0; } |