]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: magnetometer: ak8975: drop duplicate NULL check
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 5 May 2026 11:46:06 +0000 (13:46 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:36 +0000 (10:59 +0100)
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@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/ak8975.c

index b9fe2d7eeef8a8bb475e18cd9a09e4bbbe67eef3..00ac19325da6c5f698f449b21ca0272904c808ed 100644 (file)
@@ -919,8 +919,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