[PATCH v4 09/17] iio: magnetometer: ak8975: drop duplicate NULL check

From: Joshua Crofts via B4 Relay

Date: Mon May 04 2026 - 05:52:06 EST


From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

The gpiod_set_consumer_name() is NULL-aware, no need to perform the same
check in the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Signed-off-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
---
drivers/iio/magnetometer/ak8975.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 00bee434432f07e8e0bd7fb2b4c97cd2995af7a7..b94b0486421873a4afa41949d956e0bb5dafdb9d 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -916,8 +916,7 @@ static int ak8975_probe(struct i2c_client *client)
eoc_gpiod = devm_gpiod_get_optional(&client->dev, NULL, GPIOD_IN);
if (IS_ERR(eoc_gpiod))
return PTR_ERR(eoc_gpiod);
- if (eoc_gpiod)
- gpiod_set_consumer_name(eoc_gpiod, "ak_8975");
+ gpiod_set_consumer_name(eoc_gpiod, "ak_8975");

/*
* According to AK09911 datasheet, if reset GPIO is provided then

--
2.47.3