Skip to contentSkip to conversation

iio: st_pressure: st_accel: pass correct platform data to init

PATCH Applied Michael Nosthoff 2 participants 3 messages Mar 9, 2018 – Mar 12, 2018 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 iio: st_pressure: st_accel: pass correct platform data to init

Commit 7383d44b 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.

Fixes 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform data properly")
---
 drivers/iio/accel/st_accel_core.c       | 2 +-
 drivers/iio/pressure/st_pressure_core.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel_core.c +1 -1
index 460aa58..3e6fd5a 100644
@@ -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;
 
drivers/iio/pressure/st_pressure_core.c +1 -1
index 349e5c7..4ddb6cf 100644
@@ -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;
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 8 lines · On Fri, 09 Mar 2018 10:02:45 +0100 Michael Nosthoff <[email protected]> wrote:

Commit 7383d44b 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.

Quoted 6 lines

This commit fixes this.

Fixes 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform

data properly")

Both patches were corrupted by your email client. I did the revert directly and then manually applied this.

Thanks for tracking down the problem.

Applied to the fixes-togreg branch of iio.git.

Jonathan

Quoted 34 lines
---
  drivers/iio/accel/st_accel_core.c       | 2 +-
  drivers/iio/pressure/st_pressure_core.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel_core.c +1 -1
index 460aa58..3e6fd5a 100644
@@ -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;
 
drivers/iio/pressure/st_pressure_core.c +1 -1
index 349e5c7..4ddb6cf 100644
@@ -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;
#2 lore raw
Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · On Fri, 09 Mar 2018 10:02:45 +0100 Michael Nosthoff <[email protected]> wrote:

Commit 7383d44b 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.

Quoted 9 lines
Quoted 6 lines

This commit fixes this.

Fixes 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform

data properly")

Both patches were corrupted by your email client. I did the revert directly and then manually applied this.

Ah, sorry for that. I redid my setup so I hope my next patches will be fine.

Quoted 2 lines

Thanks for tracking down the problem.

Happy to help :)

Quoted 4 lines

Applied to the fixes-togreg branch of iio.git.

Jonathan

Michael