Messages in this thread |  | | Date | Fri, 23 May 2025 19:45:10 +0300 | | From | Andy Shevchenko <> | | Subject | Re: [PATCH v2] iio: common: st_sensors: Fix use of uninitialize device structs |
| |
On Thu, May 22, 2025 at 01:18:55PM +0200, Maud Spierings via B4 Relay wrote: > > Throughout the various probe functions &indio_dev->dev is used before it > is initialized. This caused a kernel panic in st_sensors_power_enable
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_err()
> dev_warn and dev_info don't seem to cause a panic, but are fixed
dev_warn() dev_info()
> as well.
> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com> > --- > When I search for general &indio_dev->dev usage, I see quite a lot more > hits, but I am not sure if there are issues with those too. > > This issue has existed for a long time it seems and therefore it is > nearly impossible to find a proper fixes tag. I would love to see it at > least backported to 6.12 as that is where I encountered it, and I > believe the patch should apply without conflicts.
> The investigation into this issue can be found in this thread [1] > > [1]: https://lore.kernel.org/all/AM7P189MB100986A83D2F28AF3FFAF976E39EA@AM7P189MB1009.EURP189.PROD.OUTLOOK.COM/
Shouldn't it be moved to the commit message as Link tag?
...
> - return dev_err_probe(&indio_dev->dev, err, > + return dev_err_probe(parent, err, > "unable to enable supplies\n");
Now it can be put on one line (yes, only 1 or 2 characters longer than 80).
...
> - dev_info(&indio_dev->dev, > + dev_info(parent, > "interrupts on the rising edge\n");
Ditto.
...
> - dev_info(&indio_dev->dev, > + dev_info(parent, > "interrupts active high level\n");
Ditto.
-- With Best Regards, Andy Shevchenko
|  |