iio:st_sensors: Fix oops when probing SPI devices
authorAlban Bedel <alban.bedel@avionic-design.de>
Mon, 20 Apr 2015 11:57:18 +0000 (13:57 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 26 Apr 2015 17:24:08 +0000 (18:24 +0100)
commit8e71c04f863a1754f21b27fb8ecb773d680a0a80
treee697db6e15c6e15b08ca84fd9c61fcce039dd685
parent97ffae1d30c3f6ceee67d5b0d3e540c08c13c744
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>
drivers/iio/accel/st_accel_core.c
drivers/iio/common/st_sensors/st_sensors_core.c
drivers/iio/gyro/st_gyro_core.c
drivers/iio/magnetometer/st_magn_core.c
drivers/iio/pressure/st_pressure_core.c