From: Chen Gang <gang.chen@asianux.com>
To: hannes@cmpxchg.org, Tejun Heo <tj@kernel.org>, js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: [Suggestion] mm/bootmem.c: need return failure code when BUG() neither CONFIG_BUG nor HAVE_ARCH_BUG is defined.
Date: Mon, 20 May 2013 16:10:18 +0800 [thread overview]
Message-ID: <5199DA6A.3010902@asianux.com> (raw)
Hello Maintainers:
If neither CONFIG_BUG nor HAVE_ARCH_BUG is defined, the BUG() will
defined as empty (e.g. randconfig with MMU for arm s5pv210)
As a function, it need return an error code to upper caller, but excuse
me, I can not find the suitable error code for return (it seems only
'return -1' is not suitable).
Please help check, thanks.
356 static int __init mark_bootmem(unsigned long start, unsigned long end,
357 int reserve, int flags)
358 {
359 unsigned long pos;
360 bootmem_data_t *bdata;
361
362 pos = start;
363 list_for_each_entry(bdata, &bdata_list, list) {
364 int err;
365 unsigned long max;
366
367 if (pos < bdata->node_min_pfn ||
368 pos >= bdata->node_low_pfn) {
369 BUG_ON(pos != start);
370 continue;
371 }
372
373 max = min(bdata->node_low_pfn, end);
374
375 err = mark_bootmem_node(bdata, pos, max, reserve, flags);
376 if (reserve && err) {
377 mark_bootmem(start, pos, 0, 0);
378 return err;
379 }
380
381 if (max == end)
382 return 0;
383 pos = bdata->node_low_pfn;
384 }
385 BUG();
386 }
Thanks.
--
Chen Gang
Asianux Corporation
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: hannes@cmpxchg.org, Tejun Heo <tj@kernel.org>, js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: [Suggestion] mm/bootmem.c: need return failure code when BUG() neither CONFIG_BUG nor HAVE_ARCH_BUG is defined.
Date: Mon, 20 May 2013 16:10:18 +0800 [thread overview]
Message-ID: <5199DA6A.3010902@asianux.com> (raw)
Hello Maintainers:
If neither CONFIG_BUG nor HAVE_ARCH_BUG is defined, the BUG() will
defined as empty (e.g. randconfig with MMU for arm s5pv210)
As a function, it need return an error code to upper caller, but excuse
me, I can not find the suitable error code for return (it seems only
'return -1' is not suitable).
Please help check, thanks.
356 static int __init mark_bootmem(unsigned long start, unsigned long end,
357 int reserve, int flags)
358 {
359 unsigned long pos;
360 bootmem_data_t *bdata;
361
362 pos = start;
363 list_for_each_entry(bdata, &bdata_list, list) {
364 int err;
365 unsigned long max;
366
367 if (pos < bdata->node_min_pfn ||
368 pos >= bdata->node_low_pfn) {
369 BUG_ON(pos != start);
370 continue;
371 }
372
373 max = min(bdata->node_low_pfn, end);
374
375 err = mark_bootmem_node(bdata, pos, max, reserve, flags);
376 if (reserve && err) {
377 mark_bootmem(start, pos, 0, 0);
378 return err;
379 }
380
381 if (max == end)
382 return 0;
383 pos = bdata->node_low_pfn;
384 }
385 BUG();
386 }
Thanks.
--
Chen Gang
Asianux Corporation
next reply other threads:[~2013-05-20 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-20 8:10 Chen Gang [this message]
2013-05-20 8:10 ` [Suggestion] mm/bootmem.c: need return failure code when BUG() neither CONFIG_BUG nor HAVE_ARCH_BUG is defined Chen Gang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5199DA6A.3010902@asianux.com \
--to=gang.chen@asianux.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=hannes@cmpxchg.org \
--cc=js1304@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.