* [PATCH] kernel/res_counter.c: move BUG() to the default choice of switch at res_counter_member()
@ 2013-01-25 8:17 Jeff Liu
2013-01-25 21:52 ` David Rientjes
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Liu @ 2013-01-25 8:17 UTC (permalink / raw)
To: linux-mm, Andrew Morton
It's quite obvious that the return statement after BUG() is invalid, we had better
move BUG() to the default choice of the switch.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
kernel/res_counter.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index ff55247..748a3bc 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -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,
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel/res_counter.c: move BUG() to the default choice of switch at res_counter_member()
2013-01-25 8:17 [PATCH] kernel/res_counter.c: move BUG() to the default choice of switch at res_counter_member() Jeff Liu
@ 2013-01-25 21:52 ` David Rientjes
0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2013-01-25 21:52 UTC (permalink / raw)
To: Jeff Liu; +Cc: linux-mm, Andrew Morton
On Fri, 25 Jan 2013, Jeff Liu wrote:
> diff --git a/kernel/res_counter.c b/kernel/res_counter.c
> index ff55247..748a3bc 100644
> --- a/kernel/res_counter.c
> +++ b/kernel/res_counter.c
> @@ -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,
This doesn't work for CONFIG_BUG=n, you still need a return value. I
think the original version was better.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-25 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 8:17 [PATCH] kernel/res_counter.c: move BUG() to the default choice of switch at res_counter_member() Jeff Liu
2013-01-25 21:52 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox