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

From: Sven Eckelmann <[email-masked]>
Date: Fri, 14 Jun 2019 20:16:45 +0200

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 <[email-masked]>
> Cc: Simon Wunderlich <[email-masked]>
> Cc: Antonio Quartulli <[email-masked]>
> Cc: "David S. Miller" <[email-masked]>
> Cc: [email-masked]
> Cc: [email-masked]
> Signed-off-by: Greg Kroah-Hartman <[email-masked]>
> ---

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