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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB03C4332F for ; Tue, 15 Nov 2022 11:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbiKOL70 (ORCPT ); Tue, 15 Nov 2022 06:59:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbiKOL7R (ORCPT ); Tue, 15 Nov 2022 06:59:17 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E8696CD8 for ; Tue, 15 Nov 2022 03:59:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 383BF13D5; Tue, 15 Nov 2022 03:59:22 -0800 (PST) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FDB43F73B; Tue, 15 Nov 2022 03:59:15 -0800 (PST) Date: Tue, 15 Nov 2022 11:59:12 +0000 From: Andre Przywara To: Fuad Tabba Cc: kvm@vger.kernel.org, julien.thierry.kdev@gmail.com, alexandru.elisei@arm.com, will@kernel.org Subject: Re: [PATCH kvmtool v1 01/17] Initialize the return value in kvm__for_each_mem_bank() Message-ID: <20221115115912.1d6f8273@donnerap.cambridge.arm.com> In-Reply-To: <20221115111549.2784927-2-tabba@google.com> References: <20221115111549.2784927-1-tabba@google.com> <20221115111549.2784927-2-tabba@google.com> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, 15 Nov 2022 11:15:33 +0000 Fuad Tabba wrote: Hi, > If none of the bank types match, the function would return an > uninitialized value. > > Signed-off-by: Fuad Tabba Indeed the comment promises to return 0 if there is no error. Reviewed-by: Andre Przywara Cheers, Andre > --- > kvm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kvm.c b/kvm.c > index 42b8812..78bc0d8 100644 > --- a/kvm.c > +++ b/kvm.c > @@ -387,7 +387,7 @@ int kvm__for_each_mem_bank(struct kvm *kvm, enum kvm_mem_type type, > int (*fun)(struct kvm *kvm, struct kvm_mem_bank *bank, void *data), > void *data) > { > - int ret; > + int ret = 0; > struct kvm_mem_bank *bank; > > list_for_each_entry(bank, &kvm->mem_banks, list) {