From: Sean Anderson Date: Mon, 14 Sep 2020 15:02:00 +0000 (-0400) Subject: gpio: dw: Add a trailing underscore to generated name X-Git-Tag: v2021.10~490^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18dbb7b335c2b4d14f2d72d77bdd60c6e5ebd25f;p=platform%2Fkernel%2Fu-boot.git gpio: dw: Add a trailing underscore to generated name Previously, if there was no bank-name property, it was easy to have confusing gpio names like "gpio1@08", instead of "gpio1@0_8". This patch follows the example of the sifive gpio driver. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c index bf324f5..a52c9e1 100644 --- a/drivers/gpio/dwapb_gpio.c +++ b/drivers/gpio/dwapb_gpio.c @@ -186,7 +186,15 @@ static int gpio_dwapb_bind(struct udevice *dev) * Fall back to node name. This means accessing pins * via bank name won't work. */ - plat->name = ofnode_get_name(node); + char name[32]; + + snprintf(name, sizeof(name), "%s_", + ofnode_get_name(node)); + plat->name = strdup(name); + if (!plat->name) { + kfree(plat); + return -ENOMEM; + } } ret = device_bind_ofnode(dev, dev->driver, plat->name,