* [RESEND] [PATCH] kernel/res_counter.c: remove useless return statement at res_counter_member()
@ 2013-02-02 5:04 Jeff Liu
2013-02-14 23:21 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2013-02-02 5:04 UTC (permalink / raw)
To: LKML; +Cc: Andrew Morton
The return statement after BUG() is invalid, 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND] [PATCH] kernel/res_counter.c: remove useless return statement at res_counter_member()
2013-02-02 5:04 [RESEND] [PATCH] kernel/res_counter.c: remove useless return statement at res_counter_member() Jeff Liu
@ 2013-02-14 23:21 ` Andrew Morton
2013-02-16 10:27 ` Jeff Liu
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-02-14 23:21 UTC (permalink / raw)
To: Jeff Liu; +Cc: LKML, David Rientjes
On Sat, 02 Feb 2013 13:04:52 +0800
Jeff Liu <jeff.liu@oracle.com> wrote:
> The return statement after BUG() is invalid, 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,
I expect it was done that way to avoid a hey-theres-no-return-statement
warning when CONFIG_BUG=n.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND] [PATCH] kernel/res_counter.c: remove useless return statement at res_counter_member()
2013-02-14 23:21 ` Andrew Morton
@ 2013-02-16 10:27 ` Jeff Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-02-16 10:27 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, David Rientjes
Hi Andrew and David,
On 02/15/2013 07:21 AM, Andrew Morton wrote:
> On Sat, 02 Feb 2013 13:04:52 +0800
> Jeff Liu <jeff.liu@oracle.com> wrote:
>
>> The return statement after BUG() is invalid, 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,
>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-16 10:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-02 5:04 [RESEND] [PATCH] kernel/res_counter.c: remove useless return statement at res_counter_member() Jeff Liu
2013-02-14 23:21 ` Andrew Morton
2013-02-16 10:27 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox