devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] pinctrl: st: fix return value check
@ 2013-06-26 16:30 Wei Yongjun
  2013-06-27 10:29 ` Linus Walleij
  2013-06-28 10:49 ` Srinivas KANDAGATLA
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Yongjun @ 2013-06-26 16:30 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

In case of error, the function pinctrl_register() returns
NULL not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.
The function syscon_regmap_lookup_by_phandle() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
 drivers/pinctrl/pinctrl-st.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 7effedf..de8c626 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -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;
 
@@ -1376,9 +1376,9 @@ static int st_pctl_probe(struct platform_device *pdev)
 	pctl_desc->name		= dev_name(&pdev->dev);
 
 	info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
-	if (IS_ERR(info->pctl)) {
+	if (!info->pctl) {
 		dev_err(&pdev->dev, "Failed pinctrl registration\n");
-		return PTR_ERR(info->pctl);
+		return -EINVAL;
 	}
 
 	for (i = 0; i < info->nbanks; i++)

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

* Re: [PATCH -next] pinctrl: st: fix return value check
  2013-06-26 16:30 [PATCH -next] pinctrl: st: fix return value check Wei Yongjun
@ 2013-06-27 10:29 ` Linus Walleij
  2013-06-28 10:49 ` Srinivas KANDAGATLA
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2013-06-27 10:29 UTC (permalink / raw)
  To: Wei Yongjun, Mark Brown
  Cc: Grant Likely, Rob Herring, Wei Yongjun,
	linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
	Srinivas Kandagatla

On Wed, Jun 26, 2013 at 6:30 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, the function pinctrl_register() returns
> NULL not ERR_PTR(). The IS_ERR() test in the return value
> check should be replaced with NULL test.
> The function syscon_regmap_lookup_by_phandle() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

This driver is merged into Mark Brown's regmap tree and need
to be applied as a fix there.

Pls resend it if Mark has not recieved it.

Include Srinivas on patches so he can ACK them.

Yours,
Linus Walleij

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

* Re: [PATCH -next] pinctrl: st: fix return value check
  2013-06-26 16:30 [PATCH -next] pinctrl: st: fix return value check Wei Yongjun
  2013-06-27 10:29 ` Linus Walleij
@ 2013-06-28 10:49 ` Srinivas KANDAGATLA
  2013-06-28 11:30   ` [PATCH -next RESEND] " Wei Yongjun
  1 sibling, 1 reply; 4+ messages in thread
From: Srinivas KANDAGATLA @ 2013-06-28 10:49 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: linus.walleij, grant.likely, rob.herring, devicetree-discuss,
	yongjun_wei, linux-kernel, Mark Brown

On 26/06/13 17:30, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> In case of error, the function pinctrl_register() returns
> NULL not ERR_PTR(). The IS_ERR() test in the return value
> check should be replaced with NULL test.
> The function syscon_regmap_lookup_by_phandle() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/pinctrl/pinctrl-st.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
> index 7effedf..de8c626 100644
> --- a/drivers/pinctrl/pinctrl-st.c
> +++ b/drivers/pinctrl/pinctrl-st.c
> @@ -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;
>  
> @@ -1376,9 +1376,9 @@ static int st_pctl_probe(struct platform_device *pdev)
>  	pctl_desc->name		= dev_name(&pdev->dev);
>  
>  	info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
> -	if (IS_ERR(info->pctl)) {
> +	if (!info->pctl) {
>  		dev_err(&pdev->dev, "Failed pinctrl registration\n");
> -		return PTR_ERR(info->pctl);
> +		return -EINVAL;
>  	}
>  
>  	for (i = 0; i < info->nbanks; i++)
> 
Thankyou for the patch, It looks OK.
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>

Can you resend it with cc to Mark Brown <broonie@kernel.org>

Thanks,
srini



> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
> 
> 

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

* [PATCH -next RESEND] pinctrl: st: fix return value check
  2013-06-28 10:49 ` Srinivas KANDAGATLA
@ 2013-06-28 11:30   ` Wei Yongjun
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2013-06-28 11:30 UTC (permalink / raw)
  To: srinivas.kandagatla, broonie
  Cc: linus.walleij, grant.likely, rob.herring, devicetree-discuss,
	yongjun_wei, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function pinctrl_register() returns
NULL not ERR_PTR(). The IS_ERR() test in the return value
check should be replaced with NULL test.
The function syscon_regmap_lookup_by_phandle() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
cc to Mark Brown
---
 drivers/pinctrl/pinctrl-st.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 7effedf..de8c626 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -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;
 
@@ -1376,9 +1376,9 @@ static int st_pctl_probe(struct platform_device *pdev)
 	pctl_desc->name		= dev_name(&pdev->dev);
 
 	info->pctl = pinctrl_register(pctl_desc, &pdev->dev, info);
-	if (IS_ERR(info->pctl)) {
+	if (!info->pctl) {
 		dev_err(&pdev->dev, "Failed pinctrl registration\n");
-		return PTR_ERR(info->pctl);
+		return -EINVAL;
 	}
 
 	for (i = 0; i < info->nbanks; i++)

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

end of thread, other threads:[~2013-06-28 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 16:30 [PATCH -next] pinctrl: st: fix return value check Wei Yongjun
2013-06-27 10:29 ` Linus Walleij
2013-06-28 10:49 ` Srinivas KANDAGATLA
2013-06-28 11:30   ` [PATCH -next RESEND] " Wei Yongjun

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