From: Paolo Bonzini <pbonzini@redhat.com>
To: "Arnd Bergmann" <arnd@arndb.de>, "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, David Hildenbrand <david@redhat.com>,
Wanpeng Li <wanpeng.li@hotmail.com>,
Junaid Shahid <junaids@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: kvm: propagate register_shrinker return code
Date: Thu, 11 Jan 2018 16:53:32 +0100 [thread overview]
Message-ID: <1658686a-1f40-7e7e-e1b0-70af6908a9d0@redhat.com> (raw)
In-Reply-To: <20180110162730.400337-1-arnd@arndb.de>
On 10/01/2018 17:26, Arnd Bergmann wrote:
> Patch "mm,vmscan: mark register_shrinker() as __must_check" is
> queued for 4.16 in linux-mm and adds a warning about the unchecked
> call to register_shrinker:
>
> arch/x86/kvm/mmu.c:5485:2: warning: ignoring return value of 'register_shrinker', declared with attribute warn_unused_result [-Wunused-result]
>
> This changes the kvm_mmu_module_init() function to fail itself
> when the call to register_shrinker fails.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/x86/kvm/mmu.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 89da688784fa..765c8e9df5d9 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -5465,30 +5465,34 @@ static void mmu_destroy_caches(void)
>
> int kvm_mmu_module_init(void)
> {
> + int ret = -ENOMEM;
> +
> kvm_mmu_clear_all_pte_masks();
>
> pte_list_desc_cache = kmem_cache_create("pte_list_desc",
> sizeof(struct pte_list_desc),
> 0, SLAB_ACCOUNT, NULL);
> if (!pte_list_desc_cache)
> - goto nomem;
> + goto out;
>
> mmu_page_header_cache = kmem_cache_create("kvm_mmu_page_header",
> sizeof(struct kvm_mmu_page),
> 0, SLAB_ACCOUNT, NULL);
> if (!mmu_page_header_cache)
> - goto nomem;
> + goto out;
>
> if (percpu_counter_init(&kvm_total_used_mmu_pages, 0, GFP_KERNEL))
> - goto nomem;
> + goto out;
>
> - register_shrinker(&mmu_shrinker);
> + ret = register_shrinker(&mmu_shrinker);
> + if (ret)
> + goto out;
>
> return 0;
>
> -nomem:
> +out:
> mmu_destroy_caches();
> - return -ENOMEM;
> + return ret;
> }
>
> /*
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2018-01-11 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 16:26 Arnd Bergmann
2018-01-11 15:53 ` Paolo Bonzini [this message]
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=1658686a-1f40-7e7e-e1b0-70af6908a9d0@redhat.com \
--to=pbonzini@redhat.com \
--cc=arnd@arndb.de \
--cc=david@redhat.com \
--cc=hpa@zytor.com \
--cc=junaids@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=wanpeng.li@hotmail.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®