drivers:iio:stm:imu:st_lsm6dsrx: fix suspend/resume procedures
The iio_devs structure for unallocated devices could be NULL so it is not healthy to recover the private pointer when unallocated. Signed-off-by: Mario Tesi <mario.tesi@st.com> Change-Id: Ibf3e87627303fc1da4fb95c00288ee6c55a45d0f Reviewed-on: https://gerrit.st.com/c/linuxandroidopen/stm-ldd-iio/+/307587 Tested-by: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Matteo DAMENO <matteo.dameno@st.com>
This commit is contained in:
parent
8fe2eed8c6
commit
6d5cb1ac0f
@ -1971,10 +1971,10 @@ static int __maybe_unused st_lsm6dsrx_suspend(struct device *dev)
|
||||
int i, err = 0;
|
||||
|
||||
for (i = 0; i < ST_LSM6DSRX_ID_MAX; i++) {
|
||||
sensor = iio_priv(hw->iio_devs[i]);
|
||||
if (!hw->iio_devs[i])
|
||||
continue;
|
||||
|
||||
sensor = iio_priv(hw->iio_devs[i]);
|
||||
if (!(hw->enable_mask & BIT_ULL(sensor->id)))
|
||||
continue;
|
||||
|
||||
@ -2027,10 +2027,10 @@ static int __maybe_unused st_lsm6dsrx_resume(struct device *dev)
|
||||
return err;
|
||||
|
||||
for (i = 0; i < ST_LSM6DSRX_ID_MAX; i++) {
|
||||
sensor = iio_priv(hw->iio_devs[i]);
|
||||
if (!hw->iio_devs[i])
|
||||
continue;
|
||||
|
||||
sensor = iio_priv(hw->iio_devs[i]);
|
||||
if (hw->enable_mask & BIT_ULL(sensor->id)) {
|
||||
err = st_lsm6dsrx_set_odr(sensor, sensor->odr,
|
||||
sensor->uodr);
|
||||
|
Loading…
Reference in New Issue
Block a user