kernel/res_counter.c: remove useless return statement at res_counter_member()
PATCH RESEND 1/1 kernel/res_counter.c: remove useless return statement at res_counter_member()
The return statement after BUG() is invalid, move BUG() to the default choice of the switch.
--- kernel/res_counter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/res_counter.c +2 -3
@@ -135,10 +135,9 @@ res_counter_member(struct res_counter *counter, int member)return &counter->failcnt;case RES_SOFT_LIMIT :return &counter->soft_limit; +default : +BUG (); }; - -BUG (); -return NULL ; } ssize_t res_counter_read(struct res_counter *counter, int member,
Signature · 1 line
1.7.9.5
Quoted 14 lines · On Sat, 02 Feb 2013 13:04:52 +0800 Jeff Liu <[email protected]> wrote:
The return statement after
BUG()is invalid, moveBUG()to the default choice of the switch.Signed-off-by Jie Liu <[email protected]>--- kernel/res_counter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)kernel/res_counter.c +0
-0@@ -135,10 +135,9 @@ res_counter_member(struct res_counter *counter, int member)return &counter->failcnt;case RES_SOFT_LIMIT :
kernel/res_counter.c res_counter_member(struct res_counter *counter, int member) · line 143
Quoted 10 lines
kernel/res_counter.c +2
-3return &counter->soft_limit; +default : +BUG (); }; - -BUG (); -return NULL ; } ssize_t res_counter_read(struct res_counter *counter, int member,
I expect it was done that way to avoid a hey-theres-no-return-statement warning when CONFIG_BUG=n.
Hi Andrew and David,
Quoted 26 lines · Andrew Morton
Quoted 23 lines · On Sat, 02 Feb 2013 13:04:52 +0800 Jeff Liu <[email protected]> wrote:
The return statement after
BUG()is invalid, moveBUG()to the default choice of the switch.Signed-off-by Jie Liu <[email protected]>--- kernel/res_counter.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)kernel/res_counter.c +2
-3@@ -135,10 +135,9 @@ res_counter_member(struct res_counter *counter, int member)return &counter->failcnt;case RES_SOFT_LIMIT :return &counter->soft_limit; +default : +BUG (); }; - -BUG (); -return NULL ; }
Quoted 5 lines
kernel/res_counter.c res_counter_member(struct res_counter *counter, int member) · line 143
Quoted 1 line
kernel/res_counter.c +0
-0ssize_t res_counter_read(struct res_counter *counter, int member,I expect it was done that way to avoid a hey-theres-no-return-statement warning when
CONFIG_BUG=n.
Sorry for my late response, I just got back from vacation. So it's better to keep it as it is.
Thanks,
-Jeff