lkml.org 
[lkml]   [2013]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init()
On 2013/11/14 16:11, Chen Gang wrote:

> Like another p?d_alloc(), pud_alloc() also may fail, so need check it.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> 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;
> + }

It looks fine to me.

Thanks,
Xishi Qiu

> pmd = pmd_alloc(&init_mm, pud, CONSISTENT_START);
> if (!pmd) {
> pr_err("%s: no pmd tables\n", __func__);




\
 
 \ /
  Last update: 2013-11-14 10:41    [W:0.055 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site