linux-metag.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init()
@ 2013-11-14  8:11 Chen Gang
       [not found] ` <528485A9.5050509-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Chen Gang @ 2013-11-14  8:11 UTC (permalink / raw)
  To: James Hogan, qiuxishi-hv44wF8Li93QT0dZR+AlfA
  Cc: Andrew Morton, linux-metag-u79uwXL29TY76Z2rM5mHXA

Like another p?d_alloc(), pud_alloc() also may fail, so need check it.

Signed-off-by: Chen Gang <gang.chen-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
---
 arch/metag/kernel/dma.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
index db589ad..e6cf39b 100644
--- a/arch/metag/kernel/dma.c
+++ b/arch/metag/kernel/dma.c
@@ -398,6 +398,11 @@ static int __init dma_alloc_init(void)
 		int offset = pgd_index(CONSISTENT_START);
 		pgd = pgd_offset(&init_mm, CONSISTENT_START);
 		pud = pud_alloc(&init_mm, pgd, CONSISTENT_START);
+		if (!pud) {
+			pr_err("%s: no pud tables\n", __func__);
+			ret = -ENOMEM;
+			break;
+		}
 		pmd = pmd_alloc(&init_mm, pud, CONSISTENT_START);
 		if (!pmd) {
 			pr_err("%s: no pmd tables\n", __func__);
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-11-14 13:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14  8:11 [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init() Chen Gang
     [not found] ` <528485A9.5050509-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-11-14  9:18   ` James Hogan
2013-11-14  9:35     ` Chen Gang
     [not found]       ` <52849961.10502-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-11-14 10:24         ` James Hogan
     [not found]           ` <5284A4CF.5070809-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2013-11-14 11:33             ` Xishi Qiu
     [not found]               ` <5284B527.8030409-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14 11:47                 ` James Hogan
2013-11-14 11:46             ` Xishi Qiu
     [not found]               ` <5284B809.6010709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14 11:51                 ` James Hogan
     [not found]                   ` <5284B93D.1000707-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2013-11-14 13:35                     ` Chen Gang
2013-11-14  9:25   ` Xishi Qiu
     [not found]     ` <52849706.3010309-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14  9:41       ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).