summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-sim.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <brgl@bgdev.pl>2022-01-20 22:49:48 +0300
committerBartosz Golaszewski <brgl@bgdev.pl>2022-01-24 11:20:02 +0300
commitdda8e14363f4f2bac0a1122322a35f47b5565d46 (patch)
treea605551957c404173a3fc1432ded9504a8b694a0 /drivers/gpio/gpio-sim.c
parente783362eb54cd99b2cac8b3a9aeac942e6f6ac07 (diff)
downloadlinux-dda8e14363f4f2bac0a1122322a35f47b5565d46.tar.xz
gpio: sim: check the label length when setting up device properties
If the user-space sets the chip label to an empty string - we should check the length and not override the default name or else line hogs will not be properly attached. Fixes: cb8c474e79be ("gpio: sim: new testing module") Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio/gpio-sim.c')
-rw-r--r--drivers/gpio/gpio-sim.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index 838bbfed11d3..04b137eca8da 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -816,7 +816,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank,
properties[prop_idx++] = PROPERTY_ENTRY_U32("ngpios", bank->num_lines);
- if (bank->label)
+ if (bank->label && (strlen(bank->label) > 0))
properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label",
bank->label);