All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <liwp.linux@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	William Irwin <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, Wanpeng Li <liwp.linux@gmail.com>
Subject: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode
Date: Tue, 10 Jul 2012 09:03:04 +0800	[thread overview]
Message-ID: <1341882184-4549-1-git-send-email-liwp.linux@gmail.com> (raw)

From: Wanpeng Li <liwp@linux.vnet.ibm.com>

When kmem_cache_alloc fails alloc slab object from
hugetlbfs_inode_cachep, return -ENOMEM in usual. But
hugetlbfs_alloc_inode implementation has inconsitency
with it and returns NULL. Fix it to return -ENOMEM.

Signed-off-by: Wanpeng Li <liwp.linux@gmail.com>
---
 fs/hugetlbfs/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c4b85d0..79a0f33 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
 	p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL);
 	if (unlikely(!p)) {
 		hugetlbfs_inc_free_inodes(sbinfo);
-		return NULL;
+		return -ENOMEM;
 	}
 	return &p->vfs_inode;
 }
-- 
1.7.5.4


WARNING: multiple messages have this Message-ID (diff)
From: Wanpeng Li <liwp.linux@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	William Irwin <wli@holomorphy.com>,
	linux-kernel@vger.kernel.org, Wanpeng Li <liwp.linux@gmail.com>
Subject: [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode
Date: Tue, 10 Jul 2012 09:03:04 +0800	[thread overview]
Message-ID: <1341882184-4549-1-git-send-email-liwp.linux@gmail.com> (raw)

From: Wanpeng Li <liwp@linux.vnet.ibm.com>

When kmem_cache_alloc fails alloc slab object from
hugetlbfs_inode_cachep, return -ENOMEM in usual. But
hugetlbfs_alloc_inode implementation has inconsitency
with it and returns NULL. Fix it to return -ENOMEM.

Signed-off-by: Wanpeng Li <liwp.linux@gmail.com>
---
 fs/hugetlbfs/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c4b85d0..79a0f33 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
 	p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL);
 	if (unlikely(!p)) {
 		hugetlbfs_inc_free_inodes(sbinfo);
-		return NULL;
+		return -ENOMEM;
 	}
 	return &p->vfs_inode;
 }
-- 
1.7.5.4

--
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>

             reply	other threads:[~2012-07-10  1:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10  1:03 Wanpeng Li [this message]
2012-07-10  1:03 ` [PATCH] mm/hugetlb: fix error code in hugetlbfs_alloc_inode Wanpeng Li
2012-07-10  1:09 ` Gavin Shan
2012-07-10  1:09   ` Gavin Shan
2012-07-10  1:15   ` Wanpeng Li
2012-07-10  1:15     ` Wanpeng Li
2012-07-10  2:01     ` David Rientjes
2012-07-10  2:01       ` David Rientjes

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=1341882184-4549-1-git-send-email-liwp.linux@gmail.com \
    --to=liwp.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wli@holomorphy.com \
    /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.