On Wed, Oct 16, 2019 at 01:15:22PM +0200, Uwe Kleine-König wrote: > On Wed, Oct 16, 2019 at 01:06:01PM +0200, Thierry Reding wrote: > > Both index and level can only be either 0 or 1 and the filter value is > > limited to values between (and including) 0 and 15. Validate that the > > device tree node contains values that are within these ranges. > > > > Signed-off-by: Thierry Reding > > --- > > drivers/pwm/pwm-stm32.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c > > index db1d675b45fb..7ff48c14fae8 100644 > > --- a/drivers/pwm/pwm-stm32.c > > +++ b/drivers/pwm/pwm-stm32.c > > @@ -530,6 +530,7 @@ static int stm32_pwm_probe_breakinputs(struct stm32_pwm *priv, > > struct device_node *np) > > { > > int nb, ret, array_size; > > + unsigned int i; > > > > nb = of_property_count_elems_of_size(np, "st,breakinput", > > sizeof(struct stm32_breakinput)); > > @@ -551,6 +552,13 @@ static int stm32_pwm_probe_breakinputs(struct stm32_pwm *priv, > > if (ret) > > return ret; > > > > + for (i = 0; i < priv->num_breakinputs; i++) { > > + if (priv->breakinputs[i].index > 1 || > > + priv->breakinputs[i].level > 1 || > > + priv->breakinputs[i].filter > 15) > > + return -EINVAL; > > + } > > + > > maybe put this patch before patch 1 that relies on index not being > bigger than 1? Yeah, that's a good idea. Does that resolve the concerns you had on patch 1? Thierry