From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Matthew Wilcox <willy@infradead.org>,
Chen Wandun <chenwandun@huawei.com>
Cc: <hughd@google.com>, <akpm@linux-foundation.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] mm/shmem: check return value of shmem_init_inodecache
Date: Wed, 1 Jun 2022 21:34:40 +0800 [thread overview]
Message-ID: <8ad1aa0b-ff8d-6a9a-d516-16425b45a55a@huawei.com> (raw)
In-Reply-To: <YpdhehYSyJFOj3Tq@casper.infradead.org>
On 2022/6/1 20:54, Matthew Wilcox wrote:
> On Wed, Jun 01, 2022 at 08:44:14PM +0800, Chen Wandun wrote:
>> -static void shmem_init_inodecache(void)
>> +static struct kmem_cache *shmem_init_inodecache(void)
>> {
>> shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
>> sizeof(struct shmem_inode_info),
>> 0, SLAB_PANIC|SLAB_ACCOUNT, shmem_init_inode);
>> +
>> + return shmem_inode_cachep;
>> }
>>
>> static void shmem_destroy_inodecache(void)
>> @@ -3924,7 +3926,10 @@ void __init shmem_init(void)
>> {
>> int error;
>>
>> - shmem_init_inodecache();
>> + if (!shmem_init_inodecache()) {
>> + error = -ENOMEM;
>> + goto out2;
>> + }
> better to return the errno from shmem_init_inodecache():
>
> error = shmem_init_inodecache();
kmem_cache_create return a pointer to the cache on success, NULL on failure,
so error = -ENOMEM; is right :)
> if (error)
> goto out2;
>
> .
next prev parent reply other threads:[~2022-06-01 13:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 12:44 [PATCH 0/4] a few cleanup and bugfixes about shmem Chen Wandun
2022-06-01 12:44 ` [PATCH 1/4] mm/shmem: check return value of shmem_init_inodecache Chen Wandun
2022-06-01 12:54 ` Matthew Wilcox
2022-06-01 13:34 ` Kefeng Wang [this message]
2022-06-01 12:44 ` [PATCH 2/4] mm/shmem: return -EINVAL for addr not PAGE_SIZE aligned Chen Wandun
2022-06-01 13:37 ` David Hildenbrand
2022-06-01 14:14 ` David Hildenbrand
2022-06-05 2:05 ` Chen Wandun
2022-06-01 12:44 ` [PATCH 3/4] mm/shmem: return error code directly Chen Wandun
2022-06-01 12:44 ` [PATCH 4/4] mm/shmem: rework calculation of inflated_addr in shmem_get_unmapped_area Chen Wandun
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=8ad1aa0b-ff8d-6a9a-d516-16425b45a55a@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=chenwandun@huawei.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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