* Re: [PATCH] crypto: cavium/nitrox - Fix 'File exists' error in 'nitrox_probe()'
[not found] <20211112085401.29306-1-aayush.a.agarwal@oracle.com>
@ 2021-11-12 8:57 ` Greg Kroah-Hartman
0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2021-11-12 8:57 UTC (permalink / raw)
To: Aayush Agarwal
Cc: Evan Xuan, Herbert Xu, David S. Miller, Amey Narkhede,
Bjorn Helgaas, Christophe JAILLET, Lee Jones, linux-crypto,
linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-12 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20211112085401.29306-1-aayush.a.agarwal@oracle.com>
2021-11-12 8:57 ` [PATCH] crypto: cavium/nitrox - Fix 'File exists' error in 'nitrox_probe()' 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).