[PATCH v5 10/18] iio: magnetometer: ak8975: drop duplicate NULL check

From: Joshua Crofts via B4 Relay

Date: Tue May 05 2026 - 07:56:45 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 c36d068081066ef6b42cc2f9c3c2e8978ec51623..7a971de2eebf127fc8ab68300fb82f38d9476c0c 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -918,8 +918,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