]> git.baikalelectronics.ru Git - kernel.git/commit
iio: mcp320x: Fix NULL pointer dereference
authorManfred Schlaegl <manfred.schlaegl@gmx.at>
Fri, 10 Jul 2015 20:55:30 +0000 (22:55 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 19 Jul 2015 12:58:51 +0000 (13:58 +0100)
commit81e4bf5c453ac2aa5fa9c7200fea827242f86688
tree75d3aac76ba345c4a1035926d64a45ef37a5809e
parent0e0c0865c91a84972da2d9ec5f0d833cbd8aee65
iio: mcp320x: Fix NULL pointer dereference

On reading in_voltage_scale of we got an NULL pointer dereference Oops.

The reason for this is, that mcp320x_read_raw tries to access
chip_info->resolution from struct mcp320x, but chip_info is never set.

chip_info was never set since the driver was added, but there was no
acute problem, because it was not referenced.
The acute problem exists since
4835474323e40b4a161b3bdb25c9e649982e4cfc
iio: adc: mcp320x. Add support for more ADCs

This patch fixes the issue by setting chip_info in mcp320x_probe.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Reviewed-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/mcp320x.c