Skip to content

Commit 85dfb43

Browse files
pelwelljic23
authored andcommitted
iio: pressure: bmp280: Fix NULL pointer exception
The bmp085 EOC IRQ support is optional, but the driver's common probe function queries the IRQ properties whether or not it exists, which can trigger a NULL pointer exception. Avoid any exception by making the query conditional on the possession of a valid IRQ. Fixes: aae9539 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt") Signed-off-by: Phil Elwell <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9a85653 commit 85dfb43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/pressure/bmp280-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ int bmp280_common_probe(struct device *dev,
21792179
* however as it happens, the BMP085 shares the chip ID of BMP180
21802180
* so we look for an IRQ if we have that.
21812181
*/
2182-
if (irq > 0 || (chip_id == BMP180_CHIP_ID)) {
2182+
if (irq > 0 && (chip_id == BMP180_CHIP_ID)) {
21832183
ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
21842184
if (ret)
21852185
return ret;

0 commit comments

Comments
 (0)