[PATCH 05/14] iio: pressure: mprls0025pa: zero out spi_transfer struct

Petre Rodan posted 14 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 05/14] iio: pressure: mprls0025pa: zero out spi_transfer struct
Posted by Petre Rodan 1 month, 3 weeks ago
Make sure that the spi_transfer struct is zeroed out before use.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
---
 drivers/iio/pressure/mprls0025pa_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/mprls0025pa_spi.c b/drivers/iio/pressure/mprls0025pa_spi.c
index 021c0ed812c0..73f0714f66ca 100644
--- a/drivers/iio/pressure/mprls0025pa_spi.c
+++ b/drivers/iio/pressure/mprls0025pa_spi.c
@@ -21,7 +21,7 @@
 static int mpr_spi_xfer(struct mpr_data *data, const u8 cmd, const u8 pkt_len)
 {
 	struct spi_device *spi = to_spi_device(data->dev);
-	struct spi_transfer xfer;
+	struct spi_transfer xfer = { };
 
 	if (pkt_len > MPR_MEASUREMENT_RD_SIZE)
 		return -EOVERFLOW;

-- 
2.51.2
Re: [PATCH 05/14] iio: pressure: mprls0025pa: zero out spi_transfer struct
Posted by Jonathan Cameron 1 month, 2 weeks ago
On Thu, 18 Dec 2025 13:05:47 +0200
Petre Rodan <petre.rodan@subdimension.ro> wrote:

> Make sure that the spi_transfer struct is zeroed out before use.
> 
> Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Hi Petre

Good catch.

Smells like a bug to me. Probably want to drag this to the start of the
patch set and add an appropriate fixes tag.

Thanks,

Jonathan

> ---
>  drivers/iio/pressure/mprls0025pa_spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/pressure/mprls0025pa_spi.c b/drivers/iio/pressure/mprls0025pa_spi.c
> index 021c0ed812c0..73f0714f66ca 100644
> --- a/drivers/iio/pressure/mprls0025pa_spi.c
> +++ b/drivers/iio/pressure/mprls0025pa_spi.c
> @@ -21,7 +21,7 @@
>  static int mpr_spi_xfer(struct mpr_data *data, const u8 cmd, const u8 pkt_len)
>  {
>  	struct spi_device *spi = to_spi_device(data->dev);
> -	struct spi_transfer xfer;
> +	struct spi_transfer xfer = { };
>  
>  	if (pkt_len > MPR_MEASUREMENT_RD_SIZE)
>  		return -EOVERFLOW;
>