All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] iio: st_pressure: st_accel: pass correct platform data to init
@ 2018-03-09  9:02 Michael Nosthoff
  2018-03-10 16:29 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Nosthoff @ 2018-03-09  9:02 UTC (permalink / raw)
  To: linux-iio; +Cc: Shrirang Bagul

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.

Cc: stable@vger.kernel.org
Fixes: 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform 
data properly")
Signed-off-by: Michael Nosthoff <committed@heine.so>
---
  drivers/iio/accel/st_accel_core.c       | 2 +-
  drivers/iio/pressure/st_pressure_core.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c 
b/drivers/iio/accel/st_accel_core.c
index 460aa58..3e6fd5a 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -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;

diff --git a/drivers/iio/pressure/st_pressure_core.c 
b/drivers/iio/pressure/st_pressure_core.c
index 349e5c7..4ddb6cf 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -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.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] iio: st_pressure: st_accel: pass correct platform data to init
  2018-03-09  9:02 [PATCH 2/2] iio: st_pressure: st_accel: pass correct platform data to init Michael Nosthoff
@ 2018-03-10 16:29 ` Jonathan Cameron
  2018-03-12  9:08   ` Michael Nosthoff
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2018-03-10 16:29 UTC (permalink / raw)
  To: Michael Nosthoff; +Cc: linux-iio, Shrirang Bagul

On Fri, 09 Mar 2018 10:02:45 +0100
Michael Nosthoff <committed@heine.so> 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.
> 
> This commit fixes this.
> 
> Cc: stable@vger.kernel.org
> Fixes: 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform 
> data properly")
> Signed-off-by: Michael Nosthoff <committed@heine.so>
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

> ---
>   drivers/iio/accel/st_accel_core.c       | 2 +-
>   drivers/iio/pressure/st_pressure_core.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/accel/st_accel_core.c 
> b/drivers/iio/accel/st_accel_core.c
> index 460aa58..3e6fd5a 100644
> --- a/drivers/iio/accel/st_accel_core.c
> +++ b/drivers/iio/accel/st_accel_core.c
> @@ -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;
> 
> diff --git a/drivers/iio/pressure/st_pressure_core.c 
> b/drivers/iio/pressure/st_pressure_core.c
> index 349e5c7..4ddb6cf 100644
> --- a/drivers/iio/pressure/st_pressure_core.c
> +++ b/drivers/iio/pressure/st_pressure_core.c
> @@ -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;
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] iio: st_pressure: st_accel: pass correct platform data to init
  2018-03-10 16:29 ` Jonathan Cameron
@ 2018-03-12  9:08   ` Michael Nosthoff
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Nosthoff @ 2018-03-12  9:08 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

On 2018-03-10 17:29, Jonathan Cameron wrote:
> On Fri, 09 Mar 2018 10:02:45 +0100
> Michael Nosthoff <committed@heine.so> 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.
>> 
>> This commit fixes this.
>> 
>> Cc: stable@vger.kernel.org
>> Fixes: 7383d44b ("iio: st_pressure: st_accel: Initialise sensor 
>> platform
>> data properly")
>> Signed-off-by: Michael Nosthoff <committed@heine.so>
> 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.

> Thanks for tracking down the problem.
> 

Happy to help :)

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

Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-12  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-09  9:02 [PATCH 2/2] iio: st_pressure: st_accel: pass correct platform data to init Michael Nosthoff
2018-03-10 16:29 ` Jonathan Cameron
2018-03-12  9:08   ` Michael Nosthoff

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.