Re: [PATCH v3] iio: common: st_sensors: Fix use of uninitialize device structs

From: Andy Shevchenko
Date: Mon May 26 2025 - 16:22:03 EST


On Mon, May 26, 2025 at 09:03:40AM +0200, Maud Spierings via B4 Relay wrote:
> From: Maud Spierings <maudspierings@xxxxxxxxxxxxxx>
>
> Throughout the various probe functions &indio_dev->dev is used before it
> is initialized. This caused a kernel panic in st_sensors_power_enable()
> when the call to devm_regulator_bulk_get_enable() fails and then calls
> dev_err_probe() with the uninitialized device.
>
> This seems to only cause a panic with dev_err_probe(), dev_err(),
> dev_warn() and dev_info() don't seem to cause a panic, but are fixed
> as well.
>
> The issue is reported and traced here: [1]

> [1]: https://lore.kernel.org/all/AM7P189MB100986A83D2F28AF3FFAF976E39EA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Make it a Link tag, e.g.,

Link: https://... [1]

>

Drop this blank line.

> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Maud Spierings <maudspierings@xxxxxxxxxxxxxx>
> ---

--
With Best Regards,
Andy Shevchenko