* [PATCH] trivial: pinctrl core: remove extraneous code lines
@ 2012-08-10 14:53 Richard Genoud
2012-08-10 15:20 ` Stephen Warren
2012-08-13 14:07 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Richard Genoud @ 2012-08-10 14:53 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Linus Walleij, linux-kernel, Richard Genoud
In function pinctrl_get_locked, pointer p is returned on error, and also
return on no_error.
So, we just return it with no error test.
It's pretty the same in function pinctrl_lookup_state_locked: state is
returned in every case, so we drop the error test and just return state.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
drivers/pinctrl/core.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index fb7f3be..7365d46 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -657,11 +657,7 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev)
if (p != NULL)
return ERR_PTR(-EBUSY);
- p = create_pinctrl(dev);
- if (IS_ERR(p))
- return p;
-
- return p;
+ return create_pinctrl(dev);
}
/**
@@ -738,10 +734,8 @@ static struct pinctrl_state *pinctrl_lookup_state_locked(struct pinctrl *p,
dev_dbg(p->dev, "using pinctrl dummy state (%s)\n",
name);
state = create_state(p, name);
- if (IS_ERR(state))
- return state;
} else {
- return ERR_PTR(-ENODEV);
+ state = ERR_PTR(-ENODEV);
}
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] trivial: pinctrl core: remove extraneous code lines
2012-08-10 14:53 [PATCH] trivial: pinctrl core: remove extraneous code lines Richard Genoud
@ 2012-08-10 15:20 ` Stephen Warren
2012-08-13 14:07 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2012-08-10 15:20 UTC (permalink / raw)
To: Richard Genoud; +Cc: Jiri Kosina, Linus Walleij, linux-kernel
On 08/10/2012 08:53 AM, Richard Genoud wrote:
> In function pinctrl_get_locked, pointer p is returned on error, and also
> return on no_error.
> So, we just return it with no error test.
>
> It's pretty the same in function pinctrl_lookup_state_locked: state is
> returned in every case, so we drop the error test and just return state.
>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> drivers/pinctrl/core.c | 10 ++--------
> 1 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index fb7f3be..7365d46 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -657,11 +657,7 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev)
> if (p != NULL)
> return ERR_PTR(-EBUSY);
>
> - p = create_pinctrl(dev);
> - if (IS_ERR(p))
> - return p;
> -
> - return p;
> + return create_pinctrl(dev);
> }
This makes sense.
> /**
> @@ -738,10 +734,8 @@ static struct pinctrl_state *pinctrl_lookup_state_locked(struct pinctrl *p,
> dev_dbg(p->dev, "using pinctrl dummy state (%s)\n",
> name);
> state = create_state(p, name);
> - if (IS_ERR(state))
> - return state;
> } else {
> - return ERR_PTR(-ENODEV);
> + state = ERR_PTR(-ENODEV);
> }
> }
Personally I find the code much clearer as it is, but the result of this
patch still looks correct.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] trivial: pinctrl core: remove extraneous code lines
2012-08-10 14:53 [PATCH] trivial: pinctrl core: remove extraneous code lines Richard Genoud
2012-08-10 15:20 ` Stephen Warren
@ 2012-08-13 14:07 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-08-13 14:07 UTC (permalink / raw)
To: Richard Genoud; +Cc: Jiri Kosina, linux-kernel
On Fri, Aug 10, 2012 at 4:53 PM, Richard Genoud
<richard.genoud@gmail.com> wrote:
> In function pinctrl_get_locked, pointer p is returned on error, and also
> return on no_error.
> So, we just return it with no error test.
>
> It's pretty the same in function pinctrl_lookup_state_locked: state is
> returned in every case, so we drop the error test and just return state.
>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Applied. While I sort of agree with Stephen on the point of the
second hunk being cleaner as it was, it's no big deal so whatever.
I took this opportunity to cut some parens tho:
@@ -657,11 +657,7 @@ static struct pinctrl *pinctrl_get_locked(struct
device *dev)
if (p != NULL)
return ERR_PTR(-EBUSY);
- p = create_pinctrl(dev);
- if (IS_ERR(p))
- return p;
-
- return p;
+ return create_pinctrl(dev);
}
/**
@@ -738,11 +734,8 @@ static struct pinctrl_state
*pinctrl_lookup_state_locked(struct pinctrl *p,
dev_dbg(p->dev, "using pinctrl dummy state (%s)\n",
name);
state = create_state(p, name);
- if (IS_ERR(state))
- return state;
- } else {
- return ERR_PTR(-ENODEV);
- }
+ } else
+ state = ERR_PTR(-ENODEV);
}
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-13 14:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-10 14:53 [PATCH] trivial: pinctrl core: remove extraneous code lines Richard Genoud
2012-08-10 15:20 ` Stephen Warren
2012-08-13 14:07 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox