iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer
PATCH 1/1 iio: adc: ti-ads1015: fix incorrect referencing of ads1015_data pointer
--- drivers/iio/adc/ti-ads1015.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-ads1015.c +2 -1
@@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {#ifdef CONFIG_OF static int ads1015_get_channels_config_of (struct i2c_client *client) { -struct ads1015_data *data =i2c_get_clientdata (client); +struct iio_dev *indio_dev =i2c_get_clientdata (client); +struct ads1015_data *data =iio_priv (indio_dev);struct device_node *node; if (!client->dev.of_node ||
Signature · 1 line
2.7.4
Quoted 12 lines · Matt Ranostay
Reported-by Giorgio <[email protected]>Cc Daniel Baluta <[email protected]>Signed-off-by Matt Ranostay <[email protected]>--- drivers/iio/adc/ti-ads1015.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/adc/ti-ads1015.c +0
-0
drivers/iio/adc/ti-ads1015.c static const struct iio_info ads1015_info = {
Quoted 10 lines
drivers/iio/adc/ti-ads1015.c +2
-2@@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {#ifdef CONFIG_OF static int ads1015_get_channels_config_of (struct i2c_client *client) { -struct ads1015_data *data =i2c_get_clientdata (client); +struct iio_dev *indio_dev =i2c_get_clientdata (client); +struct ads1015_data *data =iio_priv (indio_dev);struct device_node *node; if (!client->dev.of_node || --
Hi Matt,
Giorgio already sent a patch for this. I think we should go on his way since he found the bug.
Daniel.
Quoted 21 lines · Daniel Baluta
Quoted 20 lines · Matt Ranostay
Reported-by Giorgio <[email protected]>Cc Daniel Baluta <[email protected]>Signed-off-by Matt Ranostay <[email protected]>--- drivers/iio/adc/ti-ads1015.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/adc/ti-ads1015.c +2
-1@@ -403,7 +403,8 @@ static const struct iio_info ads1015_info = {#ifdef CONFIG_OF static int ads1015_get_channels_config_of (struct i2c_client *client) { -struct ads1015_data *data =i2c_get_clientdata (client); +struct iio_dev *indio_dev =i2c_get_clientdata (client); +struct ads1015_data *data =iio_priv (indio_dev);struct device_node *node;
Quoted 7 lines
drivers/iio/adc/ti-ads1015.c static const struct iio_info ads1015_info = {
Quoted 2 lines
drivers/iio/adc/ti-ads1015.c +0
-1if (!client->dev.of_node || --Hi Matt,
Giorgio already sent a patch for this. I think we should go on his way since he found the bug.
Ah! see both a bug report and patch earlier now :)
Although do you know if there are anymore drivers we had to make a iio version of hwmon for the triggered buffer? I suspect this was a simple copy and paste error from the hwmon driver
Quoted 2 lines
Daniel.
PATCH 1/1 iio:ti-ads1015: fix a wrong pointer definition.
The call to i2c_get_clientdata(client) returns a struct iio_dev*, not the needed struct ads1015_data*. We need here an intermediate step as in the function: void ads1015_get_channels_config(struct i2c_client *client).
--- drivers/iio/adc/ti-ads1015.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-ads1015.c +2 -1
@@ -489,7 +489,8 @@ static struct iio_info ads1115_info = {#ifdef CONFIG_OF static int ads1015_get_channels_config_of (struct i2c_client *client) { -struct ads1015_data *data =i2c_get_clientdata (client); +struct iio_dev *indio_dev =i2c_get_clientdata (client); +struct ads1015_data *data =iio_priv (indio_dev);struct device_node *node; if (!client->dev.of_node ||
Signature · 1 line
2.9.3
Jonathan Cameron
maintainerRe: [PATCH 1/1] iio:ti-ads1015: fix a wrong pointer definition.
Quoted 5 lines · Giorgio Dal Molin
The call to
i2c_get_clientdata(client)returns a struct iio_dev*, not the needed struct ads1015_data*. We need here an intermediate step as in the function: voidads1015_get_channels_config(struct i2c_client *client).Signed-off-by Giorgio Dal Molin <[email protected]>
Applied with the addition of a fixes tag to the fixes-togreg branch of iio.git.
I've also marked this for stable.
Thanks,
Jonathan
Quoted 19 lines
--- drivers/iio/adc/ti-ads1015.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/adc/ti-ads1015.c +2
-1@@ -489,7 +489,8 @@ static struct iio_info ads1115_info = {#ifdef CONFIG_OF static int ads1015_get_channels_config_of (struct i2c_client *client) { -struct ads1015_data *data =i2c_get_clientdata (client); +struct iio_dev *indio_dev =i2c_get_clientdata (client); +struct ads1015_data *data =iio_priv (indio_dev);struct device_node *node; if (!client->dev.of_node ||