From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Subject: Re: [PATCH] kvm: no need to check return value of debugfs_create functions Date: Tue, 22 Jan 2019 09:21:02 -0800 Message-ID: <20190122172102.GE28513@linux.intel.com> References: <20190122152151.16139-51-gregkh@linuxfoundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: linux-kernel@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , kvm@vger.kernel.org To: Greg Kroah-Hartman Return-path: Content-Disposition: inline In-Reply-To: <20190122152151.16139-51-gregkh@linuxfoundation.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Tue, Jan 22, 2019 at 04:21:50PM +0100, Greg Kroah-Hartman wrote: > When calling debugfs functions, there is no need to ever check the > return value. The function can work or not, but the code logic should > never do something different based on this. What about wanting to make the debugfs all-or-nothing? That seems like a legitimate usage of checking the return value. E.g. KVM removes the debugfs if kvm_arch_create_vcpu_debugfs() fails, and the arch/x86/kvm/debugfs.c implementation of kvm_arch_create_vcpu_debugfs() returns an error if any of its debugfs_create_file() calls fail. If you're adamant about removing all debugfs create return value checks, the aforementioned debugfs_create_file() calls should also be removed. And at that point kvm_create_vcpu_debugfs() should have a 'void' return value. > > Cc: Paolo Bonzini > Cc: "Radim Krčmář" > Cc: kvm@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman > --- > virt/kvm/kvm_main.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 5ecea812cb6a..4f96450ecdfc 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -2528,9 +2528,7 @@ static int kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) > > snprintf(dir_name, sizeof(dir_name), "vcpu%d", vcpu->vcpu_id); > vcpu->debugfs_dentry = debugfs_create_dir(dir_name, > - vcpu->kvm->debugfs_dentry); > - if (!vcpu->debugfs_dentry) > - return -ENOMEM; > + vcpu->kvm->debugfs_dentry); > > ret = kvm_arch_create_vcpu_debugfs(vcpu); > if (ret < 0) { > -- > 2.20.1 >