summaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer
diff options
context:
space:
mode:
authorAlban Bedel <alban.bedel@avionic-design.de>2015-04-20 13:57:18 +0200
committerJonathan Cameron <jic23@kernel.org>2015-04-26 18:24:08 +0100
commit8e71c04f863a1754f21b27fb8ecb773d680a0a80 (patch)
treee697db6e15c6e15b08ca84fd9c61fcce039dd685 /drivers/iio/magnetometer
parent97ffae1d30c3f6ceee67d5b0d3e540c08c13c744 (diff)
downloadop-kernel-dev-8e71c04f863a1754f21b27fb8ecb773d680a0a80.zip
op-kernel-dev-8e71c04f863a1754f21b27fb8ecb773d680a0a80.tar.gz
iio:st_sensors: Fix oops when probing SPI devices
In SPI mode the transfer buffer is locked with a mutex. However this mutex is only initilized after the probe, but some transfer needs to be done in the probe. To fix this bug we move the mutex initialization at the beginning of the device probe. Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de> Acked-by: Denis Ciocca <denis.ciocca@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r--drivers/iio/magnetometer/st_magn_core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 8ade473..2e56f81 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -369,6 +369,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &magn_info;
+ mutex_init(&mdata->tb.buf_lock);
st_sensors_power_enable(indio_dev);
OpenPOWER on IntegriCloud