Skip to content

Commit

Permalink
iio: st_pressure: st_accel: pass correct platform data to init
Browse files Browse the repository at this point in the history
Commit 7383d44 added a pointer pdata which get set to the default
platform_data when non was defined in the device. But it did not
pass this pointer to the st_sensors_init_sensor call but still
used the maybe uninitialized platform_data from dev.

This breaks initialization when no platform_data is given and
the optional st,drdy-int-pin devicetree option is not set.

This commit fixes this.

Cc: stable@vger.kernel.org
Fixes: 7383d44 ("iio: st_pressure: st_accel: Initialise sensor platform data properly")
Signed-off-by: Michael Nosthoff <committed@heine.so>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Michael Nosthoff authored and Jonathan Cameron committed Mar 10, 2018
1 parent cc4e003 commit 8b43868
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/iio/accel/st_accel_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
if (!pdata)
pdata = (struct st_sensors_platform_data *)&default_accel_pdata;

err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data);
err = st_sensors_init_sensor(indio_dev, pdata);
if (err < 0)
goto st_accel_power_off;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/pressure/st_pressure_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ int st_press_common_probe(struct iio_dev *indio_dev)
press_data->sensor_settings->drdy_irq.int2.addr))
pdata = (struct st_sensors_platform_data *)&default_press_pdata;

err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
err = st_sensors_init_sensor(indio_dev, pdata);
if (err < 0)
goto st_press_power_off;

Expand Down

0 comments on commit 8b43868

Please sign in to comment.