linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vmw_ballon: no need to check return value of debugfs_create functions
@ 2019-06-11 18:55 Greg Kroah-Hartman
  2019-06-11 19:36 ` Nadav Amit
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-11 18:55 UTC (permalink / raw)
  To: Julien Freche, Nadav Amit, VMware, Inc.; +Cc: Arnd Bergmann, linux-kernel

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.

Cc: Julien Freche <jfreche@vmware.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: "VMware, Inc." <pv-drivers@vmware.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/vmw_balloon.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index ad807d5a3141..fdf5ad757226 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1516,19 +1516,10 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset)
 
 DEFINE_SHOW_ATTRIBUTE(vmballoon_debug);
 
-static int __init vmballoon_debugfs_init(struct vmballoon *b)
+static void __init vmballoon_debugfs_init(struct vmballoon *b)
 {
-	int error;
-
 	b->dbg_entry = debugfs_create_file("vmmemctl", S_IRUGO, NULL, b,
 					   &vmballoon_debug_fops);
-	if (IS_ERR(b->dbg_entry)) {
-		error = PTR_ERR(b->dbg_entry);
-		pr_err("failed to create debugfs entry, error: %d\n", error);
-		return error;
-	}
-
-	return 0;
 }
 
 static void __exit vmballoon_debugfs_exit(struct vmballoon *b)
@@ -1541,9 +1532,8 @@ static void __exit vmballoon_debugfs_exit(struct vmballoon *b)
 
 #else
 
-static inline int vmballoon_debugfs_init(struct vmballoon *b)
+static inline void vmballoon_debugfs_init(struct vmballoon *b)
 {
-	return 0;
 }
 
 static inline void vmballoon_debugfs_exit(struct vmballoon *b)
@@ -1555,7 +1545,6 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
 static int __init vmballoon_init(void)
 {
 	enum vmballoon_page_size_type page_size;
-	int error;
 
 	/*
 	 * Check if we are running on VMware's hypervisor and bail out
@@ -1571,9 +1560,7 @@ static int __init vmballoon_init(void)
 
 	INIT_DELAYED_WORK(&balloon.dwork, vmballoon_work);
 
-	error = vmballoon_debugfs_init(&balloon);
-	if (error)
-		return error;
+	vmballoon_debugfs_init(&balloon);
 
 	spin_lock_init(&balloon.comm_lock);
 	init_rwsem(&balloon.conf_sem);
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vmw_ballon: no need to check return value of debugfs_create functions
  2019-06-11 18:55 [PATCH] vmw_ballon: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-11 19:36 ` Nadav Amit
  2019-06-12 11:35   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Nadav Amit @ 2019-06-11 19:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Julien Freche, Pv-drivers, Arnd Bergmann, linux-kernel

Please change the title of the patch to “vmw_balloon” (it is currently
“vmw_ballon”).

> On Jun 11, 2019, at 11:55 AM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> 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.

I remember I saw a discussion about it, and didn’t know the resolution.

If that's the decision (assuming debugfs initialization always succeeds),
and after fixing the title of the patch:

  Acked-by: Nadav Amit <namit@vmware.com>

Thanks!
Nadav

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vmw_ballon: no need to check return value of debugfs_create functions
  2019-06-11 19:36 ` Nadav Amit
@ 2019-06-12 11:35   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-12 11:35 UTC (permalink / raw)
  To: Nadav Amit; +Cc: Julien Freche, Pv-drivers, Arnd Bergmann, linux-kernel

On Tue, Jun 11, 2019 at 07:36:36PM +0000, Nadav Amit wrote:
> Please change the title of the patch to “vmw_balloon” (it is currently
> “vmw_ballon”).

Oops, will fix, sorry about that.

> > On Jun 11, 2019, at 11:55 AM, Greg Kroah-Hartman <gregkh@linuxfoundation.org> 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.
> 
> I remember I saw a discussion about it, and didn’t know the resolution.
> 
> If that's the decision (assuming debugfs initialization always succeeds),
> and after fixing the title of the patch:
> 
>   Acked-by: Nadav Amit <namit@vmware.com>

Thanks for the review!

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-12 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 18:55 [PATCH] vmw_ballon: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-11 19:36 ` Nadav Amit
2019-06-12 11:35   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).