iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe()
commit 43c0f6456f801181a80b73d95def0e0fd134e1cc upstream.
`devm_gpiod_get_optional()` may return non-NULL error pointer on failure.
Check its return value using `IS_ERR()` and propagate the error if
necessary.
Fixes: df6e71256c ("iio: pressure: bmp280: Explicitly mark GPIO optional")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250818092740.545379-2-salah.triki@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c4cd93811e
commit
6f9b83b10b
@@ -1064,11 +1064,12 @@ int bmp280_common_probe(struct device *dev,
|
||||
|
||||
/* Bring chip out of reset if there is an assigned GPIO line */
|
||||
gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(gpiod))
|
||||
return dev_err_probe(dev, PTR_ERR(gpiod), "failed to get reset GPIO\n");
|
||||
|
||||
/* Deassert the signal */
|
||||
if (gpiod) {
|
||||
dev_info(dev, "release reset\n");
|
||||
gpiod_set_value(gpiod, 0);
|
||||
}
|
||||
dev_info(dev, "release reset\n");
|
||||
gpiod_set_value(gpiod, 0);
|
||||
|
||||
data->regmap = regmap;
|
||||
ret = regmap_read(regmap, BMP280_REG_ID, &chip_id);
|
||||
|
||||
Reference in New Issue
Block a user