Skip to content

Commit

Permalink
gpio: sim: check the label length when setting up device properties
Browse files Browse the repository at this point in the history
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: cb8c474 ("gpio: sim: new testing module")
Signed-off-by: Bartosz Golaszewski <[email protected]>
  • Loading branch information
brgl committed Jan 24, 2022
1 parent e783362 commit dda8e14
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpio/gpio-sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit dda8e14

Please sign in to comment.