Skip to contentSkip to conversation

pinctrl: st: Fix checking return value of syscon_regmap_lookup_by_phandle()

PATCH In review Axel Lin 2 participants 5 messages Jun 28, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 pinctrl: st: Fix checking return value of syscon_regmap_lookup_by_phandle()

syscon_regmap_lookup_by_phandle() returns ERR_PTR on error.

---
 drivers/pinctrl/pinctrl-st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +2 -2
index 7effedf..f95c82a 100644
@@ -1299,9 +1299,9 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
 		return -ENOMEM;
 
 	info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
-	if (!info->regmap) {
+	if (IS_ERR(info->regmap)) {
 		dev_err(info->dev, "No syscfg phandle specified\n");
-		return -ENOMEM;
+		return PTR_ERR(info->regmap);
 	}
 	info->data = of_match_node(st_pctl_of_match, np)->data;
 
Signature · 1 line
1.8.1.2
#1 lore raw

Thankyou Axel for looking at this.

There is already a patch is submitted for this.
https://lkml.org/lkml/2013/6/26/494 which I have Acked.

Thanks,
srini

Quoted 24 lines · Axel Lin

syscon_regmap_lookup_by_phandle() returns ERR_PTR on error.

---
 drivers/pinctrl/pinctrl-st.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-st.c +2 -2
index 7effedf..f95c82a 100644
@@ -1299,9 +1299,9 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
 		return -ENOMEM;
 
 	info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
-	if (!info->regmap) {
+	if (IS_ERR(info->regmap)) {
 		dev_err(info->dev, "No syscfg phandle specified\n");
-		return -ENOMEM;
+		return PTR_ERR(info->regmap);
 	}
 	info->data = of_match_node(st_pctl_of_match, np)->data;
 
author
#2 lore raw

2013/6/28 Srinivas KANDAGATLA <[email protected]>:

Quoted 4 lines

Thankyou Axel for looking at this.

There is already a patch is submitted for this.
https://lkml.org/lkml/2013/6/26/494 which I have Acked.

That is strange.
I don't think the patch you mentioned can be applied to current pinctrl tree. Current code does check pinctrl_register by IS_ERR.

        info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
        if (IS_ERR(info->pctl)) {

Regards,
Axel

#3 lore raw
Quoted 9 lines · Axel Lin

2013/6/28 Srinivas KANDAGATLA <[email protected]>:

Quoted 4 lines

Thankyou Axel for looking at this.

There is already a patch is submitted for this.
https://lkml.org/lkml/2013/6/26/494 which I have Acked.

That is strange.
I don't think the patch you mentioned can be applied to current pinctrl tree. Current code does check pinctrl_register by IS_ERR.

The patch removes the IS_ERR, because, pinctrl_register returns NULL or a valid pointer, using IS_ERR is this case is incorrect.

Thanks,
srini

Quoted 8 lines
        info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
        if (IS_ERR(info->pctl)) {

Regards,
Axel

author
#4 lore raw

2013/6/28 Srinivas KANDAGATLA <[email protected]>:

Quoted 12 lines · Axel Lin
Quoted 9 lines

2013/6/28 Srinivas KANDAGATLA <[email protected]>:

Quoted 4 lines

Thankyou Axel for looking at this.

There is already a patch is submitted for this.
https://lkml.org/lkml/2013/6/26/494 which I have Acked.

That is strange.
I don't think the patch you mentioned can be applied to current pinctrl tree. Current code does check pinctrl_register by IS_ERR.

The patch removes the IS_ERR, because, pinctrl_register returns NULL or a valid pointer, using IS_ERR is this case is incorrect.

You are right.

Thanks,
Axel