From: fl.scratchpad@gmail.com
To: jic23@kernel.org,
Alexandru Tachici <alexandru.tachici@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Alexandru Ardelean <aardelean@deviqon.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Fabrizio Lamarque <fl.scratchpad@gmail.com>,
Nuno Sa <nuno.sa@analog.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH v3 1/5] iio: adc: ad7192: Fix null ad7192_state pointer access
Date: Tue, 30 May 2023 09:53:07 +0200 [thread overview]
Message-ID: <20230530075311.400686-2-fl.scratchpad@gmail.com> (raw)
In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com>
From: Fabrizio Lamarque <fl.scratchpad@gmail.com>
Pointer to indio_dev structure is obtained via spi_get_drvdata() at
the beginning of function ad7192_setup(), but the spi->dev->driver_data
member is not initialized, hence a NULL pointer is returned.
Fix by changing ad7192_setup() signature to take pointer to struct
iio_dev, and get ad7192_state pointer via st = iio_priv(indio_dev);
Fixes: bd5dcdeb3fd0 ("iio: adc: ad7192: convert to device-managed functions")
Signed-off-by: Fabrizio Lamarque <fl.scratchpad@gmail.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
---
drivers/iio/adc/ad7192.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 55a6ab591016..94a9cf34a255 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -380,9 +380,9 @@ static int ad7192_of_clock_select(struct ad7192_state *st)
return clock_sel;
}
-static int ad7192_setup(struct ad7192_state *st, struct device_node *np)
+static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np)
{
- struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
+ struct ad7192_state *st = iio_priv(indio_dev);
bool rej60_en, refin2_en;
bool buf_en, bipolar, burnout_curr_en;
unsigned long long scale_uv;
@@ -1073,7 +1073,7 @@ static int ad7192_probe(struct spi_device *spi)
}
}
- ret = ad7192_setup(st, spi->dev.of_node);
+ ret = ad7192_setup(indio_dev, spi->dev.of_node);
if (ret)
return ret;
--
2.34.1
next prev parent reply other threads:[~2023-05-30 7:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 7:53 [PATCH v3 0/5] Fix ad7192 driver issues fl.scratchpad
2023-05-30 7:53 ` fl.scratchpad [this message]
2023-06-04 11:32 ` [PATCH v3 1/5] iio: adc: ad7192: Fix null ad7192_state pointer access Jonathan Cameron
2023-05-30 7:53 ` [PATCH v3 2/5] iio: adc: ad7192: Fix internal/external clock selection fl.scratchpad
2023-06-04 11:33 ` Jonathan Cameron
2023-05-30 7:53 ` [PATCH v3 3/5] iio: adc: ad7192: Use VRef instead of AVdd as reference voltage source fl.scratchpad
2023-06-03 12:03 ` andy.shevchenko
2023-05-30 7:53 ` [PATCH v3 4/5] dt-bindings: iio: ad7192: Add mandatory " fl.scratchpad
2023-05-30 17:22 ` Conor Dooley
2023-06-04 11:35 ` Jonathan Cameron
2023-05-30 7:53 ` [PATCH v3 5/5] dt-bindings: iio: ad7192: Allow selection of clock modes fl.scratchpad
2023-05-30 17:22 ` Conor Dooley
2023-05-31 6:59 ` Fabrizio Lamarque
2023-05-31 7:14 ` Krzysztof Kozlowski
2023-05-31 9:40 ` Fabrizio Lamarque
2023-05-31 12:56 ` Conor Dooley
[not found] ` <01dae949-4018-37f4-2dd9-cbecbd65b9a1@linaro.org>
2023-06-07 7:40 ` Fabrizio Lamarque
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230530075311.400686-2-fl.scratchpad@gmail.com \
--to=fl.scratchpad@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=aardelean@deviqon.com \
--cc=alexandru.tachici@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox