diff options
author | Chris Packham <judge.packham@gmail.com> | 2023-07-26 11:13:08 +1200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2023-07-31 13:50:57 +0200 |
commit | 414236b887a2270d714edf3654eaa0def6315ec6 (patch) | |
tree | ba0be3a6cb4c1ca68e3a8c6f5dc88e42b73869c6 /drivers/i2c | |
parent | a36d59ba99a19c777d896d4c70e75975654e2831 (diff) | |
download | u-boot-414236b887a2270d714edf3654eaa0def6315ec6.tar.gz u-boot-414236b887a2270d714edf3654eaa0def6315ec6.tar.bz2 u-boot-414236b887a2270d714edf3654eaa0def6315ec6.zip |
i2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings
gpio_request_list_by_name() returns the number of gpios requested.
Notably it swallows the underlying -ENOENT when the "gpios" property
does not exist.
Update the i2c-gpio driver to check for ret == 0 before trying the new
sda-gpios/scl-gpios properties.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-gpio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 4ed9e9e7cd..c1fc290bd2 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -339,7 +339,7 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) /* "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) { + if (ret == 0) { ret = gpio_request_by_name(dev, "sda-gpios", 0, &bus->gpios[PIN_SDA], 0); if (ret < 0) |