lkml.org 
[lkml]   [2022]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] mm/shmem: check return value of shmem_init_inodecache
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();
if (error)
goto out2;

\
 
 \ /
  Last update: 2022-06-01 14:55    [W:1.231 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site