linux_dsm_epyc7002/drivers/iio
Evan Green db23d88756 iio: adc: qcom-spmi-adc5: Initialize prescale properly
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>
2018-12-12 17:45:30 +00:00
..
accel iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID 2018-11-25 12:35:26 +00:00
adc iio: adc: qcom-spmi-adc5: Initialize prescale properly 2018-12-12 17:45:30 +00:00
afe iio: afe: rescale: new driver 2018-04-28 18:03:22 +01:00
amplifiers drivers: iio: Update MODULE AUTHOR email address 2018-08-19 17:23:39 +01:00
buffer iio:kfifo_buf: check for uint overflow 2018-03-30 11:16:12 +01:00
chemical iio: chemical: bme680: Remove field value defines 2018-08-25 09:13:45 +01:00
common iio: hid-sensor-hub: clean up indentation, remove extraneous tab 2018-11-25 14:03:59 +00:00
counter iio: 104-quad-8: Provide defines for magic numbers 2018-06-10 11:52:30 +01:00
dac iio: dac: ad5686: fix bit shift read register 2018-12-08 15:45:09 +00:00
dummy iio:dummy: Add extra paragraphs on Kconfig 2018-03-03 15:20:16 +00:00
frequency iio: Convert to using %pOFn instead of device_node.name 2018-09-02 18:54:31 +01:00
gyro iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW 2018-03-07 20:14:36 +00:00
health iio: health: max30102: Mark expected switch fall-throughs 2018-08-19 17:21:35 +01:00
humidity iio: add SPDX identifier for various drivers 2018-02-18 11:55:19 +00:00
imu iio: bmi160: use all devm functions in probe 2018-12-10 21:15:41 +00:00
light First set of new device support, features and cleanups for IIO in the 4.21 cycle 2018-11-22 09:39:45 +01:00
magnetometer iio: magnetometer: ak8975: Add the "AKM9911" ACPI HID 2018-12-01 16:05:56 +00:00
multiplexer iio: multiplexer: switch to SPDX license identifier 2018-08-20 19:28:26 +01:00
orientation iio:orientation: drop assign iio_info.driver_module 2017-08-22 21:33:36 +01:00
potentiometer iio: potentiometer: Add driver for Microchip MCP41xxx/42xxx 2018-11-25 12:35:26 +00:00
potentiostat iio: potentiostat: lmp91000: add LMP91002 support 2018-05-12 11:02:44 +01:00
pressure iio: pressure: ms5611: switch to SPDX identifier 2018-09-08 15:04:02 +01:00
proximity iio: proximity: Add driver support for ST's VL53L0X ToF ranging sensor. 2018-09-22 16:42:56 +01:00
resolver staging:iio:ad2s90: Move out of staging 2018-12-01 15:40:39 +00:00
temperature Merge remote-tracking branches 'regmap/topic/noinc' and 'regmap/topic/single-rw' into regmap-next 2018-10-21 12:07:26 +01:00
trigger drivers: iio: Update MODULE AUTHOR email address 2018-08-19 17:23:39 +01:00
iio_core_trigger.h
iio_core.h the rest of drivers/*: annotate ->poll() instances 2017-11-28 11:06:58 -05:00
industrialio-buffer.c First round of IIO fixes for the 4.16 cycle. 2018-02-20 10:03:22 +01:00
industrialio-configfs.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-core.c iio: core: check 'info' value before registering the device 2018-12-08 11:06:41 +00:00
industrialio-event.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
industrialio-sw-device.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-sw-trigger.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-trigger.c iio:trigger: Remove necessity to have a trig->ops structure. 2017-08-22 21:20:28 +01:00
industrialio-triggered-event.c iio: Support triggered events 2015-08-27 20:47:09 +01:00
inkern.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
Kconfig staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00
Makefile staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00