From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 359F3C433F5 for ; Wed, 1 Jun 2022 12:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F55B8D0016; Wed, 1 Jun 2022 08:54:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A4AD8D000E; Wed, 1 Jun 2022 08:54:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86A638D0016; Wed, 1 Jun 2022 08:54:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 759038D000E for ; Wed, 1 Jun 2022 08:54:28 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 40D46209ED for ; Wed, 1 Jun 2022 12:54:28 +0000 (UTC) X-FDA: 79529660616.18.8E87D39 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id D2B43C006F for ; Wed, 1 Jun 2022 12:53:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ugEdXtdPTz7l7vpumg4n6fVUSq1X4RC9jlklJg1z4yw=; b=dvg2T38wTK91QzKunvS1ZhpYsz nYopqQYOkSlqGxqxpyRCRjqcc2HS+2EmcnGRv4AeqQj1VkJxcThnmGoE+Uslfn7LZpfJOPKlUUnyR jKuJ4cIc4CiUMX8QKhLv5vayfYrn6nmt73DIf73TsPNr47GuunPRndUFiPkIFiHx3RrXTjRrXHYjD CKybdte42ObKCfhrfKPCjkjz5BXkpTzU2hippQ6dtYFBIQB9vEYbY99JecDNfxzlUHIeb+8nErAWB dpnbbNIzHRuX9QS05I5s2i72tcgFwFN9ThACS/JVu8yI4OrNWkUHcVHl4uITDHq+3M6e5HcZqkGBd Q466yiQw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwNre-006IlO-LK; Wed, 01 Jun 2022 12:54:18 +0000 Date: Wed, 1 Jun 2022 13:54:18 +0100 From: Matthew Wilcox To: Chen Wandun 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 Message-ID: References: <20220601124417.2872001-1-chenwandun@huawei.com> <20220601124417.2872001-2-chenwandun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220601124417.2872001-2-chenwandun@huawei.com> X-Rspamd-Queue-Id: D2B43C006F X-Stat-Signature: smxuico5mka3abrfrzrui5x398p6dxhp X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=dvg2T38w; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam08 X-HE-Tag: 1654088026-277546 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;