diff options
| author | Salah Triki <[email protected]> | 2025-08-18 09:27:30 +0000 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2025-08-18 18:22:18 +0000 |
| commit | 43c0f6456f801181a80b73d95def0e0fd134e1cc (patch) | |
| tree | 74e035cfd703aeac46e3cf6c37a211d4494435a5 | |
| parent | iio: light: as73211: Ensure buffer holes are zeroed (diff) | |
| download | kernel-43c0f6456f801181a80b73d95def0e0fd134e1cc.tar.gz kernel-43c0f6456f801181a80b73d95def0e0fd134e1cc.zip | |
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: df6e71256c84 ("iio: pressure: bmp280: Explicitly mark GPIO optional")
Signed-off-by: Salah Triki <[email protected]>
Reviewed-by: David Lechner <[email protected]>
Link: https://patch.msgid.link/[email protected]
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
| -rw-r--r-- | drivers/iio/pressure/bmp280-core.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 74505c9ec1a0..6cdc8ed53520 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -3213,11 +3213,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; |
