2012-06-18 17:46:13

by devendra.aaru

[permalink] [raw]
Subject: [PATCH 2/2] pinctrl/pinctrl-spear: remove IS_ERR checking of pmx->pctl

pinctrl_register returns a pointer of struct type struct pinctrl_dev,
if successfully registered to pinctrl subsystem, otherwise returns
NULL, and there wont' be any pointers which are not dereferencible.

They are not type of pointer addresses but are kind of error
codes rather actual addresses, but are a kind of return
codes of functions returning integer types.

return -ENODEV if device registration fails.

Signed-off-by: Devendra Naga <[email protected]>
---
drivers/pinctrl/spear/pinctrl-spear.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 5ae50aa..b9a52c9 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -336,9 +336,9 @@ int __devinit spear_pinctrl_probe(struct platform_device *pdev,
spear_pinctrl_desc.npins = machdata->npins;

pmx->pctl = pinctrl_register(&spear_pinctrl_desc, &pdev->dev, pmx);
- if (IS_ERR(pmx->pctl)) {
+ if (!pmx->pctl) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
- return PTR_ERR(pmx->pctl);
+ return -ENODEV;
}

return 0;
--
1.7.9.5


2012-06-20 07:59:20

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/2] pinctrl/pinctrl-spear: remove IS_ERR checking of pmx->pctl

On Mon, Jun 18, 2012 at 7:46 PM, Devendra Naga <[email protected]> wrote:

> pinctrl_register returns a pointer of struct type struct pinctrl_dev,
> if successfully registered to pinctrl subsystem, otherwise returns
> NULL, and there wont' be any pointers which are not dereferencible.
>
> They are not type of pointer addresses but are kind of error
> codes rather actual addresses, but are a kind of return
> codes of functions returning integer types.
>
> return -ENODEV if device registration fails.
>
> Signed-off-by: Devendra Naga <[email protected]>

Applied, thanks!
Linus Walleij