Re: [PATCH] batman-adv: no need to check return value of debugfs_create functions

Sven Eckelmann
2019-06-14T18:16:45Z

[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]

On Friday, 14 June 2019 09:11:23 CEST 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.
>
> Because we don't care if debugfs works or not, this trickles back a bit
> so we can clean things up by making some functions return void instead
> of an error value that is never going to fail.
>
> Cc: Marek Lindner <mareklindner@neomailbox.ch>
> Cc: Simon Wunderlich <sw@simonwunderlich.de>
> Cc: Antonio Quartulli <a@unstable.cc>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: b.a.t.m.a.n@lists.open-mesh.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---

Applied with minor modifications

> /**
> @@ -333,42 +315,24 @@ void batadv_debugfs_destroy(void)
> * batadv_debugfs_add_hardif() - creates the base directory for a hard interface
> * in debugfs.
> * @hard_iface: hard interface which should be added.
> - *
> - * Return: 0 on success or negative error number in case of failure
> */
> -int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
> +void batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
> {
> struct net *net = dev_net(hard_iface->net_dev);
> struct batadv_debuginfo **bat_debug;
> struct dentry *file;

The file variable should be removed here (it is now unused).

> @@ -421,42 +382,28 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
> struct net *net = dev_net(dev);
> struct dentry *file;

Same here

> --- a/net/batman-adv/log.c
> +++ b/net/batman-adv/log.c
> @@ -192,25 +192,16 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
> {
> struct dentry *d;

Same here

Thanks,
Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]