linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call
@ 2019-09-20 12:20 Colin King
  2019-09-20 14:24 ` Tony Lindgren
  2019-10-04 21:09 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-09-20 12:20 UTC (permalink / raw)
  To: Linus Walleij, Tony Lindgren, YueHaibing, Nishanth Menon,
	Tero Kristo, linux-gpio
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The call to pinctrl_count_index_with_args checks for a -EINVAL return
however this function calls pinctrl_get_list_and_count and this can
return -ENOENT. Rather than check for a specific error, fix this by
checking for any error return to catch the -ENOENT case.

Addresses-Coverity: ("Improper use of negative")
Fixes: 003910ebc83b ("pinctrl: Introduce TI IOdelay configuration driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
index e5e7f1f22813..b522ca010332 100644
--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
+++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c
@@ -496,7 +496,7 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev,
 		return -EINVAL;
 
 	rows = pinctrl_count_index_with_args(np, name);
-	if (rows == -EINVAL)
+	if (rows < 0)
 		return rows;
 
 	*map = devm_kzalloc(iod->dev, sizeof(**map), GFP_KERNEL);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call
  2019-09-20 12:20 [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call Colin King
@ 2019-09-20 14:24 ` Tony Lindgren
  2019-10-04 21:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2019-09-20 14:24 UTC (permalink / raw)
  To: Colin King
  Cc: Linus Walleij, YueHaibing, Nishanth Menon, Tero Kristo,
	linux-gpio, kernel-janitors, linux-kernel

* Colin King <colin.king@canonical.com> [190920 12:21]:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The call to pinctrl_count_index_with_args checks for a -EINVAL return
> however this function calls pinctrl_get_list_and_count and this can
> return -ENOENT. Rather than check for a specific error, fix this by
> checking for any error return to catch the -ENOENT case.

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call
  2019-09-20 12:20 [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call Colin King
  2019-09-20 14:24 ` Tony Lindgren
@ 2019-10-04 21:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2019-10-04 21:09 UTC (permalink / raw)
  To: Colin King
  Cc: Tony Lindgren, YueHaibing, Nishanth Menon, Tero Kristo,
	open list:GPIO SUBSYSTEM, kernel-janitors, linux-kernel

On Fri, Sep 20, 2019 at 2:20 PM Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
>
> The call to pinctrl_count_index_with_args checks for a -EINVAL return
> however this function calls pinctrl_get_list_and_count and this can
> return -ENOENT. Rather than check for a specific error, fix this by
> checking for any error return to catch the -ENOENT case.
>
> Addresses-Coverity: ("Improper use of negative")
> Fixes: 003910ebc83b ("pinctrl: Introduce TI IOdelay configuration driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied with Tony's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-04 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 12:20 [PATCH] pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call Colin King
2019-09-20 14:24 ` Tony Lindgren
2019-10-04 21:09 ` Linus Walleij

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).