public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Aayush Agarwal <aayush.a.agarwal@oracle.com>
Cc: Evan Xuan <jian.xuan@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Amey Narkhede <ameynarkhede03@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Lee Jones <lee.jones@linaro.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: cavium/nitrox - Fix 'File exists' error in 'nitrox_probe()'
Date: Fri, 12 Nov 2021 09:57:38 +0100	[thread overview]
Message-ID: <YY4sgh89YZNpIjGt@kroah.com> (raw)
In-Reply-To: <20211112085401.29306-1-aayush.a.agarwal@oracle.com>

On Fri, Nov 12, 2021 at 12:54:00AM -0800, Aayush Agarwal wrote:
> When two cavium cards are inserted and on booting OS,
> nitrox_debugfs_init() is called twice and thus tries to create
> 'n5pf' directory twice inside '/'. This causes the 'File exists' error.
> 
> This error was handled before
> 'commit 97a93b2b5839 ("crypto: cavium/nitrox - no need to check return
> value of debugfs_create functions")'
> 
> This commit handles the error by redirecting the code by checking
> if 'n5pf' directory exists already using 'debugfs_lookup()' function.
> 
> Tested-by: Evan Xuan <jian.xuan@oracle.com>
> Signed-off-by: Aayush Agarwal <aayush.a.agarwal@oracle.com>
> ---
>  drivers/crypto/cavium/nitrox/nitrox_main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c
> index 6c61817996a3..1eee05e30f05 100644
> --- a/drivers/crypto/cavium/nitrox/nitrox_main.c
> +++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
> @@ -7,6 +7,7 @@
>  #include <linux/mutex.h>
>  #include <linux/pci.h>
>  #include <linux/pci_ids.h>
> +#include <linux/debugfs.h>
>  
>  #include "nitrox_dev.h"
>  #include "nitrox_common.h"
> @@ -479,6 +480,13 @@ static int nitrox_probe(struct pci_dev *pdev,
>  	if (err)
>  		goto pf_hw_fail;
>  
> +	struct dentry *check_dir = debugfs_lookup(KBUILD_MODNAME, NULL);
> +
> +	if (check_dir != NULL) {
> +		dput(check_dir);
> +		goto pf_hw_fail;

Why is this a "failure"?

> +	}
> +
>  	nitrox_debugfs_init(ndev);

Why not just put the "check" logic in this function instead?
You want to have per-device directories in debugfs for this device,
right?  If so, then this function should handle that, not the
nitrox_probe() call.

thanks,

greg k-h

           reply	other threads:[~2021-11-12  8:57 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20211112085401.29306-1-aayush.a.agarwal@oracle.com>]

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=YY4sgh89YZNpIjGt@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=aayush.a.agarwal@oracle.com \
    --cc=ameynarkhede03@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jian.xuan@oracle.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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