i2c-gpio: condition is always false

Sergei Antonov saproj at gmail.com
Thu Oct 20 16:50:16 CEST 2022


Hello!
Please look at this code from drivers/i2c/i2c-gpio.c:

static int i2c_gpio_of_to_plat(struct udevice *dev)
{
        struct i2c_gpio_bus *bus = dev_get_priv(dev);
        int ret;

        /* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */
        ret = gpio_request_list_by_name(dev, "gpios", bus->gpios,
                                        ARRAY_SIZE(bus->gpios), 0);
        if (ret == -ENOENT) {

The condition is always false because in
gpio_request_list_by_name_nodev(), if entry is not found, this code
will work:
        if (ret == -ENOENT)
                break;
and then
        return count;
return zero.


More information about the U-Boot mailing list