public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xishi Qiu <qiuxishi@huawei.com>
To: Chen Gang <gang.chen@asianux.com>
Cc: James Hogan <james.hogan@imgtec.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	<linux-metag@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init()
Date: Thu, 14 Nov 2013 17:25:26 +0800	[thread overview]
Message-ID: <52849706.3010309@huawei.com> (raw)
In-Reply-To: <528485A9.5050509@asianux.com>

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__);



       reply	other threads:[~2013-11-14  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <528485A9.5050509@asianux.com>
2013-11-14  9:25 ` Xishi Qiu [this message]
2013-11-14  9:41   ` [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init() 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=52849706.3010309@huawei.com \
    --to=qiuxishi@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=gang.chen@asianux.com \
    --cc=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-metag@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox