netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Minjie Du <duminjie@vivo.com>
Cc: Marcin Wojtas <mw@semihalf.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"open list:MARVELL MVPP2 ETHERNET DRIVER"
	<netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	opensource.kernel@vivo.com
Subject: Re: [PATCH v1] drivers/net: marvell: mvpp2: fix debugfs_create_dir() return check in three functions
Date: Sat, 15 Jul 2023 11:48:17 +0100	[thread overview]
Message-ID: <ZLJ5ccZcmo/ol/Dm@corigine.com> (raw)
In-Reply-To: <20230713044507.3275-1-duminjie@vivo.com>

On Thu, Jul 13, 2023 at 12:45:07PM +0800, Minjie Du wrote:
> Make IS_ERR() judge the debugfs_create_dir() function return
> in mvpp2_dbgfs_c2_entry_init(), mvpp2_dbgfs_flow_tbl_entry_init()
>  and mvpp2_dbgfs_cls_init()
> Line 562 deletes the space because checkpatch reports an error.
> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
> index 75e83ea2a..37bff3304 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
> @@ -559,7 +559,7 @@ static int mvpp2_dbgfs_prs_entry_init(struct dentry *parent,
>  			    &mvpp2_dbgfs_prs_hits_fops);
>  
>  	debugfs_create_file("pmap", 0444, prs_entry_dir, entry,
> -			     &mvpp2_dbgfs_prs_pmap_fops);
> +			    &mvpp2_dbgfs_prs_pmap_fops);

Unfortunately net-next does not accept patches for Checkpatch warnings
of this nature.

>  
>  	return 0;
>  }
> @@ -593,7 +593,7 @@ static int mvpp2_dbgfs_c2_entry_init(struct dentry *parent,
>  	sprintf(c2_entry_name, "%03d", id);
>  
>  	c2_entry_dir = debugfs_create_dir(c2_entry_name, parent);
> -	if (!c2_entry_dir)
> +	if (IS_ERR(c2_entry_dir))
>  		return -ENOMEM;

As per the comment above debugfs_create_dir(), it is not
expected to return an error, and in general callers should
ignore the return value.

I expect a good approach here is to simply remove the error handling
for debugfs_create_dir(). e.g.

-	if (!c2_entry_dir)
-		return -ENOMEM;

-- 
pw-bot: changes-requested

      parent reply	other threads:[~2023-07-15 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13  4:45 [PATCH v1] drivers/net: marvell: mvpp2: fix debugfs_create_dir() return check in three functions Minjie Du
2023-07-13 15:43 ` [PATCH] " Markus Elfring
2023-07-15 10:48 ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLJ5ccZcmo/ol/Dm@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=duminjie@vivo.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).