Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1518204 > unrolled thread
| Started by | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| First post | 2016-11-09 15:30 +0100 |
| Last post | 2016-11-09 16:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] pinctrl: single: check for any error when getting rows Axel Haslam <ahaslam@baylibre.com> - 2016-11-09 15:30 +0100
Re: [PATCH] pinctrl: single: check for any error when getting rows Tony Lindgren <tony@atomide.com> - 2016-11-09 16:20 +0100
| From | Axel Haslam <ahaslam@baylibre.com> |
|---|---|
| Date | 2016-11-09 15:30 +0100 |
| Subject | [PATCH] pinctrl: single: check for any error when getting rows |
| Message-ID | <sBC30-8sr-7@gated-at.bofh.it> |
pinctrl_count_index_with_args returns -ENOENT not -EINVAL. The return check would pass, and we would try to kzalloc with a negative error size throwing a warning. Instead of checking for -EINVAL specifically, lets check for any error and avoid negative size allocations. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> --- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 539f31c..56e22be 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1228,7 +1228,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, struct pcs_function *function; rows = pinctrl_count_index_with_args(np, name); - if (rows == -EINVAL) + if (rows < 0) return rows; npins_in_row = pcs->width / pcs->bits_per_pin; -- 2.10.1
[toc] | [next] | [standalone]
| From | Tony Lindgren <tony@atomide.com> |
|---|---|
| Date | 2016-11-09 16:20 +0100 |
| Message-ID | <sBCPn-Bf-9@gated-at.bofh.it> |
| In reply to | #1518204 |
* Axel Haslam <ahaslam@baylibre.com> [161109 07:19]: > pinctrl_count_index_with_args returns -ENOENT not > -EINVAL. The return check would pass, and we would > try to kzalloc with a negative error size throwing > a warning. > > Instead of checking for -EINVAL specifically, lets > check for any error and avoid negative size allocations. > > Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Thanks for fixing that: Acked-by: Tony Lindgren <tony@atomide.com> > --- > drivers/pinctrl/pinctrl-single.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c > index 539f31c..56e22be 100644 > --- a/drivers/pinctrl/pinctrl-single.c > +++ b/drivers/pinctrl/pinctrl-single.c > @@ -1228,7 +1228,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, > struct pcs_function *function; > > rows = pinctrl_count_index_with_args(np, name); > - if (rows == -EINVAL) > + if (rows < 0) > return rows; > > npins_in_row = pcs->width / pcs->bits_per_pin; > -- > 2.10.1 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web