forked from luck/tmp_suning_uos_patched
db23d88756
adc5_get_dt_data uses a local, prop, feeds it to adc5_get_dt_channel_data, and then puts the result into adc->chan_props. The problem is adc5_get_dt_channel_data may not initialize that structure fully, so a garbage value is used for prescale if the optional "qcom,pre-scaling" is not defined in DT. adc5_read_raw then uses this as an array index, generating a crash that looks like this: [ 6.683186] Unable to handle kernel paging request at virtual address ffffff90e78c7964 Call trace: qcom_vadc_scale_code_voltage_factor+0x74/0x104 qcom_vadc_scale_hw_calib_die_temp+0x20/0x60 qcom_adc5_hw_scale+0x78/0xa4 adc5_read_raw+0x3d0/0x65c iio_channel_read+0x240/0x30c iio_read_channel_processed+0x10c/0x150 qpnp_tm_get_temp+0xc0/0x40c of_thermal_get_temp+0x7c/0x98 thermal_zone_get_temp+0xac/0xd8 thermal_zone_device_update+0xc0/0x38c qpnp_tm_probe+0x624/0x81c platform_drv_probe+0xe4/0x11c really_probe+0x188/0x3fc driver_probe_device+0xb8/0x188 __device_attach_driver+0x114/0x180 bus_for_each_drv+0xd8/0x118 __device_attach+0x180/0x27c device_initial_probe+0x20/0x2c bus_probe_device+0x78/0x124 deferred_probe_work_func+0xfc/0x138 process_one_work+0x3d8/0x8b0 process_scheduled_works+0x48/0x6c worker_thread+0x488/0x7cc kthread+0x24c/0x264 ret_from_fork+0x10/0x18 Unfortunately, when I went to add the initializer for this and tried to boot it, my machine shut down immediately, complaining that it was hotter than the sun. It appears that adc5_chans_pmic and adc5_chans_rev2 were initializing prescale_index as if it were directly a divisor, rather than the index into adc5_prescale_ratios that it is. Fix the uninitialized value, and change the static initialization to use indices into adc5_prescale_ratios. Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
||
---|---|---|
.. | ||
ad_sigma_delta.c | ||
ad799x.c | ||
ad7124.c | ||
ad7266.c | ||
ad7291.c | ||
ad7298.c | ||
ad7476.c | ||
ad7766.c | ||
ad7791.c | ||
ad7793.c | ||
ad7887.c | ||
ad7923.c | ||
ad7949.c | ||
aspeed_adc.c | ||
at91_adc.c | ||
at91-sama5d2_adc.c | ||
axp20x_adc.c | ||
axp288_adc.c | ||
bcm_iproc_adc.c | ||
berlin2-adc.c | ||
cc10001_adc.c | ||
cpcap-adc.c | ||
da9150-gpadc.c | ||
dln2-adc.c | ||
envelope-detector.c | ||
ep93xx_adc.c | ||
exynos_adc.c | ||
fsl-imx25-gcq.c | ||
hi8435.c | ||
hx711.c | ||
imx7d_adc.c | ||
ina2xx-adc.c | ||
Kconfig | ||
lp8788_adc.c | ||
lpc18xx_adc.c | ||
lpc32xx_adc.c | ||
ltc2471.c | ||
ltc2485.c | ||
ltc2497.c | ||
Makefile | ||
max1027.c | ||
max1118.c | ||
max1363.c | ||
max9611.c | ||
max11100.c | ||
mcp320x.c | ||
mcp3422.c | ||
mcp3911.c | ||
men_z188_adc.c | ||
meson_saradc.c | ||
mt6577_auxadc.c | ||
mxs-lradc-adc.c | ||
nau7802.c | ||
palmas_gpadc.c | ||
qcom-pm8xxx-xoadc.c | ||
qcom-spmi-adc5.c | ||
qcom-spmi-iadc.c | ||
qcom-spmi-vadc.c | ||
qcom-vadc-common.c | ||
qcom-vadc-common.h | ||
rcar-gyroadc.c | ||
rockchip_saradc.c | ||
sc27xx_adc.c | ||
sd_adc_modulator.c | ||
spear_adc.c | ||
stm32-adc-core.c | ||
stm32-adc-core.h | ||
stm32-adc.c | ||
stm32-dfsdm-adc.c | ||
stm32-dfsdm-core.c | ||
stm32-dfsdm.h | ||
stx104.c | ||
sun4i-gpadc-iio.c | ||
ti_am335x_adc.c | ||
ti-adc081c.c | ||
ti-adc084s021.c | ||
ti-adc108s102.c | ||
ti-adc128s052.c | ||
ti-adc161s626.c | ||
ti-adc0832.c | ||
ti-adc12138.c | ||
ti-ads1015.c | ||
ti-ads7950.c | ||
ti-ads8688.c | ||
ti-tlc4541.c | ||
twl4030-madc.c | ||
twl6030-gpadc.c | ||
vf610_adc.c | ||
viperboard_adc.c | ||
xilinx-xadc-core.c | ||
xilinx-xadc-events.c | ||
xilinx-xadc.h |