* [PATCH] gpio: sim: check the label length when setting up device properties
@ 2022-01-20 19:49 Bartosz Golaszewski
2022-01-20 22:18 ` Kent Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2022-01-20 19:49 UTC (permalink / raw)
To: Kent Gibson, Linus Walleij, Andy Shevchenko
Cc: linux-gpio, Bartosz Golaszewski
If the user-space sets the chip label to an empty string - we should
check the length and assign the default name or otherwise line hogs
will not be properly attached.
Fixes: cb8c474e79be ("gpio: sim: new testing module")
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
--
2.30.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: sim: check the label length when setting up device properties
2022-01-20 19:49 [PATCH] gpio: sim: check the label length when setting up device properties Bartosz Golaszewski
@ 2022-01-20 22:18 ` Kent Gibson
2022-01-24 8:20 ` Bartosz Golaszewski
0 siblings, 1 reply; 3+ messages in thread
From: Kent Gibson @ 2022-01-20 22:18 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Linus Walleij, Andy Shevchenko, linux-gpio
On Thu, Jan 20, 2022 at 08:49:48PM +0100, Bartosz Golaszewski wrote:
> If the user-space sets the chip label to an empty string - we should
> check the length and assign the default name or otherwise line hogs
> will not be properly attached.
>
"assign" -> "not override"?
Cheers,
Kent.
> Fixes: cb8c474e79be ("gpio: sim: new testing module")
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
> drivers/gpio/gpio-sim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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);
>
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: sim: check the label length when setting up device properties
2022-01-20 22:18 ` Kent Gibson
@ 2022-01-24 8:20 ` Bartosz Golaszewski
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2022-01-24 8:20 UTC (permalink / raw)
To: Kent Gibson; +Cc: Linus Walleij, Andy Shevchenko, open list:GPIO SUBSYSTEM
On Thu, Jan 20, 2022 at 11:18 PM Kent Gibson <warthog618@gmail.com> wrote:
>
> On Thu, Jan 20, 2022 at 08:49:48PM +0100, Bartosz Golaszewski wrote:
> > If the user-space sets the chip label to an empty string - we should
> > check the length and assign the default name or otherwise line hogs
> > will not be properly attached.
> >
>
> "assign" -> "not override"?
>
> Cheers,
> Kent.
>
> > Fixes: cb8c474e79be ("gpio: sim: new testing module")
> > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> > ---
> > drivers/gpio/gpio-sim.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > 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);
> >
> > --
> > 2.30.1
> >
Fixed when applying.
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-24 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20 19:49 [PATCH] gpio: sim: check the label length when setting up device properties Bartosz Golaszewski
2022-01-20 22:18 ` Kent Gibson
2022-01-24 8:20 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).