[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1203111322550.20299@chino.kir.corp.google.com>
Date: Sun, 11 Mar 2012 13:25:20 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Hillf Danton <dhillf@...il.com>
cc: LKML <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] hugetlbfs: add err code in initializing module
On Sun, 11 Mar 2012, Hillf Danton wrote:
> --- a/fs/hugetlbfs/inode.c Sun Mar 11 12:46:38 2012
> +++ b/fs/hugetlbfs/inode.c Sun Mar 11 12:49:28 2012
> @@ -1000,6 +1000,7 @@ static int __init init_hugetlbfs_fs(void
> hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
> sizeof(struct hugetlbfs_inode_info),
> 0, 0, init_once);
> + error = -ENOMEM;
> if (hugetlbfs_inode_cachep == NULL)
> goto out2;
>
The patch looks good, however, we typically do things like
error = -ENOMEM;
hugetlbfs_inode_cachep = kmem_cache_create(...);
if (!hugetlbfs_inode_cachep)
...
instead. Sometimes people grep to see if a call a function that can fail,
such as kmem_cache_create(), is followed up by a check for NULL and this
would otherwise fail.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists