Skip to contentSkip to conversation

i2c: i2c-gpio: Correctly handle new {sda,scl}-gpios bindings

PATCH Superseded Chris Packham 1 participant 1 message Jul 20, 2023 I2C

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 drivers/i2c/i2c-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-gpio.c +1 -1
index 4ed9e9e7cddd..c1fc290bd253 100644
@@ -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)
Signature · 1 line
2.41.0