All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Wang Sheng-Hui <shhuiw@gmail.com>
Cc: yinghai@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/memblock.c: return -ENOMEM instead of -ENXIO on failure of debugfs_create_dir in memblock_init_debugfs
Date: Tue, 22 Nov 2011 15:55:07 -0800	[thread overview]
Message-ID: <20111122155507.af6c10e9.akpm@linux-foundation.org> (raw)
In-Reply-To: <4EB9DEF6.4080905@gmail.com>

On Wed, 09 Nov 2011 10:01:26 +0800
Wang Sheng-Hui <shhuiw@gmail.com> wrote:

> On the failure of debugfs_create_dir, we should return -ENOMEM
> instead of -ENXIO.
> 
> The patch is against 3.1.
> 
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
>  mm/memblock.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index ccbf973..4d4d5ee 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -852,7 +852,7 @@ static int __init memblock_init_debugfs(void)
>  {
>  	struct dentry *root = debugfs_create_dir("memblock", NULL);
>  	if (!root)
> -		return -ENXIO;
> +		return -ENOMEM;
>  	debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
>  	debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);

Well, we don't know what we should return because
debugfs_create_file() is misdesigned - it should return an ERR_PTR.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Wang Sheng-Hui <shhuiw@gmail.com>
Cc: yinghai@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/memblock.c: return -ENOMEM instead of -ENXIO on failure of debugfs_create_dir in memblock_init_debugfs
Date: Tue, 22 Nov 2011 15:55:07 -0800	[thread overview]
Message-ID: <20111122155507.af6c10e9.akpm@linux-foundation.org> (raw)
In-Reply-To: <4EB9DEF6.4080905@gmail.com>

On Wed, 09 Nov 2011 10:01:26 +0800
Wang Sheng-Hui <shhuiw@gmail.com> wrote:

> On the failure of debugfs_create_dir, we should return -ENOMEM
> instead of -ENXIO.
> 
> The patch is against 3.1.
> 
> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
>  mm/memblock.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index ccbf973..4d4d5ee 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -852,7 +852,7 @@ static int __init memblock_init_debugfs(void)
>  {
>  	struct dentry *root = debugfs_create_dir("memblock", NULL);
>  	if (!root)
> -		return -ENXIO;
> +		return -ENOMEM;
>  	debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
>  	debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);

Well, we don't know what we should return because
debugfs_create_file() is misdesigned - it should return an ERR_PTR.


  reply	other threads:[~2011-11-22 23:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09  2:01 [PATCH 1/2] mm/memblock.c: return -ENOMEM instead of -ENXIO on failure of debugfs_create_dir in memblock_init_debugfs Wang Sheng-Hui
2011-11-09  2:01 ` Wang Sheng-Hui
2011-11-22 23:55 ` Andrew Morton [this message]
2011-11-22 23:55   ` Andrew Morton

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=20111122155507.af6c10e9.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shhuiw@gmail.com \
    --cc=yinghai@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.