Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1643877
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function |
| Date | 2017-05-18 09:00 +0200 |
| Message-ID | <tInzH-6pb-7@gated-at.bofh.it> (permalink) |
| References | <tIngm-6dz-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Thu, May 18, 2017 at 08:36:07AM +0200, Quentin Schulz wrote:
> For the sake of DT binding stability, this IIO driver is a child of an
> MFD driver for Allwinner A10, A13 and A31 because there already exists a
> DT binding for this IP. The MFD driver has a DT node but the IIO driver
> does not.
>
> The IIO device registers the temperature sensor in the thermal framework
> using the DT node of the parent, the MFD device, so the thermal
> framework could match the phandle to the MFD device in the DT and the
> struct device used to register in the thermal framework.
>
> devm_thermal_zone_of_sensor_register was previously used to register the
> thermal sensor with the parent struct device of the IIO device,
> representing the MFD device. By doing so, we registered actually the
> parent in the devm routine and not the actual IIO device.
>
> This lead to the devm unregister function not being called when the IIO
> module driver is removed. It resulted in the thermal framework still
> polling the get_temp function of the IIO module while the device doesn't
> exist anymore, thus generated a kernel panic.
>
> Use the non-devm function instead and do the unregister manually in the
> remove function.
>
> Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-05-18 08:40 +0200
Re: [PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-18 09:00 +0200
Re: [PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function Jonathan Cameron <jic23@kernel.org> - 2017-05-21 16:20 +0200
Re: [PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-05-21 21:10 +0200
Re: [PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function Jonathan Cameron <jic23@kernel.org> - 2017-05-24 22:10 +0200
csiph-web