pinctrl: single: check for any error when getting rows
Subsystems (3)
PATCH 1/1 pinctrl: single: check for any error when getting rows
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 <[email protected]>
--- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-single.c +1 -1
@@ -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;
Signature · 1 line
2.10.1
Quoted 9 lines · Axel Haslam
pinctrl_count_index_with_argsreturns-ENOENTnot-EINVAL. The return check would pass, and we would try to kzalloc with a negative error size throwing a warning.Instead of checking for
-EINVALspecifically, lets check for any error and avoid negative size allocations.Signed-off-by Axel Haslam <[email protected]>
Thanks for fixing that:
Acked-by Tony Lindgren <[email protected]>
Quoted 20 lines
--- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/pinctrl-single.c +1
-1@@ -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;Signature · 1 line
2.10.1