patch "iio: pressure: bmp280: fix runtime suspend/resume crash" added to staging-linus
Subsystems (2)
This is a note to let you know that I've just added the patch titled
iio: pressure: bmp280: fix runtime suspend/resume crash
to my staging git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
in the staging-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
Quoted 1 line
From
31f453eac56bdc41f434126bc2d5933b9fb720ecMon Sep 17 00:00:00 2001
From: Linus Walleij <[email protected]>
Date: Wed, 27 Jul 2016 22:32:58 +0200
Subject: iio: pressure: bmp280: fix runtime suspend/resume crash
In commit 3d838118c6aa ("iio: pressure: bmp280: add power management")
For some reason the code in the runtime suspend/resume hooks got wrong (I suspect in the ambition to cut down boilerplate) and it seems it was tested without CONFIG_PM and crashes like so for me:
Unable to handle kernel NULL pointer dereference at virtual address 0000000c pgd = c0204000 [0000000c] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM Modules linked in: CPU: 1 PID: 89 Comm: kworker/1:2 Not tainted 4.7.0-03348-g90dc3680458a-dirty #99 Hardware name: Generic DT based system Workqueue: pm pm_runtime_work task: df3c6300 ti: dec8a000 task.ti: dec8a000 PC is at regulator_disable+0x0/0x6c LR is at bmp280_runtime_suspend+0x3c/0xa4
Dereferencing the BMP280 state container properly fixes the problem, sorry for screwing up.
--- drivers/iio/pressure/bmp280-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/pressure/bmp280-core.c +4 -2
@@ -1079,7 +1079,8 @@ EXPORT_SYMBOL(bmp280_common_remove);#ifdef CONFIG_PM static int bmp280_runtime_suspend (struct device *dev) { -struct bmp280_data *data =dev_get_drvdata (dev); +struct iio_dev *indio_dev =dev_get_drvdata (dev); +struct bmp280_data *data =iio_priv (indio_dev);int ret; ret =regulator_disable (data->vdda);
@@ -1090,7 +1091,8 @@ static int bmp280_runtime_suspend(struct device *dev)static int bmp280_runtime_resume (struct device *dev) { -struct bmp280_data *data =dev_get_drvdata (dev); +struct iio_dev *indio_dev =dev_get_drvdata (dev); +struct bmp280_data *data =iio_priv (indio_dev);int ret; ret =regulator_enable (data->vddd);
Signature · 1 line
2.9.3