Skip to contentSkip to conversation

pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call

PATCH In review Colin King 3 participants 3 messages Sep 20, 2019 – Oct 4, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call

From: Colin Ian King <[email protected]>

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")
---
 drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +1 -1
index e5e7f1f22813..b522ca010332 100644
@@ -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);
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

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.

#2 lore raw
In reply to Colin King
Quoted 10 lines · Colin King

From: Colin Ian King <[email protected]>

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

Patch applied with Tony's ACK.

Yours,
Linus Walleij