[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230930152831.432647d7@jic23-huawei>
Date: Sat, 30 Sep 2023 15:28:31 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-staging@...ts.linux.dev,
David Lechner <david@...hnology.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Nuno Sá <nuno.sa@...log.com>,
Axel Haslam <ahaslam@...libre.com>,
Philip Molloy <pmolloy@...libre.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 02/27] staging: iio: resolver: ad2s1210: fix use
before initialization
On Fri, 29 Sep 2023 12:23:07 -0500
David Lechner <dlechner@...libre.com> wrote:
> From: David Lechner <david@...hnology.com>
>
> From: David Lechner <dlechner@...libre.com>
>
> This fixes a use before initialization in ad2s1210_probe(). The
> ad2s1210_setup_gpios() function uses st->sdev but it was being called
> before this field was initialized.
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
Applied to the togreg banch of iio.git and pushed out as testing for 0-day to
poke at it.
I didn't pull this out as a fix to upstream quicker because it would
make a mess of the rest of applying the rest of the series.
Maybe we want to consider backporting some of these at somepoint.
Jonathan
> ---
>
> v3 changes:
> * This is a new patch split out from "staging: iio: resolver: ad2s1210:
> fix probe"
>
> drivers/staging/iio/resolver/ad2s1210.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> index f695ca0547e4..3f08b59f4e19 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -658,9 +658,6 @@ static int ad2s1210_probe(struct spi_device *spi)
> if (!indio_dev)
> return -ENOMEM;
> st = iio_priv(indio_dev);
> - ret = ad2s1210_setup_gpios(st);
> - if (ret < 0)
> - return ret;
>
> spi_set_drvdata(spi, indio_dev);
>
> @@ -671,6 +668,10 @@ static int ad2s1210_probe(struct spi_device *spi)
> st->resolution = 12;
> st->fexcit = AD2S1210_DEF_EXCIT;
>
> + ret = ad2s1210_setup_gpios(st);
> + if (ret < 0)
> + return ret;
> +
> indio_dev->info = &ad2s1210_info;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = ad2s1210_channels;
>
Powered by blists - more mailing lists