mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe()
`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>
This commit is contained in:
parent
433b99e922
commit
43c0f6456f
@ -3213,11 +3213,12 @@ int bmp280_common_probe(struct device *dev,
|
|||||||
|
|
||||||
/* Bring chip out of reset if there is an assigned GPIO line */
|
/* Bring chip out of reset if there is an assigned GPIO line */
|
||||||
gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
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 */
|
/* Deassert the signal */
|
||||||
if (gpiod) {
|
dev_info(dev, "release reset\n");
|
||||||
dev_info(dev, "release reset\n");
|
gpiod_set_value(gpiod, 0);
|
||||||
gpiod_set_value(gpiod, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
data->regmap = regmap;
|
data->regmap = regmap;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user