linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary R Hook <ghook@amd.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	David Miller <davem@davemloft.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
	"Hook, Gary" <Gary.Hook@amd.com>
Subject: Re: [PATCH 6/7] crypto: ccp: no need to check return value of debugfs_create functions
Date: Tue, 22 Jan 2019 22:06:54 +0000	[thread overview]
Message-ID: <1330d284-560a-5e09-6d15-50da354d0da2@amd.com> (raw)
In-Reply-To: <20190122151422.14204-7-gregkh@linuxfoundation.org>

On 1/22/19 9:14 AM, 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.

Stupid question(s) time.

If we don't care about failures (because the subsystem handles them 
without our involvement) why do these functions even have return values? 
Why haven't they been changed to void so that they reflect the current 
style of intended use?

I realize I'm old fashioned, but if a failure occurs, I've always been 
of a mind to kick out and not try to do any further work. But debugfs is 
to be treated as an exception to that paradigm? Carry on, ignore errors, 
don't worry about it?

That said,

Acked-by: Gary R Hook <gary.hook@amd.com>

> 
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Gary Hook <gary.hook@amd.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   drivers/crypto/ccp/ccp-debugfs.c | 36 +++++++-------------------------
>   1 file changed, 7 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c
> index 1a734bd2070a..4bd26af7098d 100644
> --- a/drivers/crypto/ccp/ccp-debugfs.c
> +++ b/drivers/crypto/ccp/ccp-debugfs.c
> @@ -286,10 +286,7 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
>   {
>   	struct ccp_cmd_queue *cmd_q;
>   	char name[MAX_NAME_LEN + 1];
> -	struct dentry *debugfs_info;
> -	struct dentry *debugfs_stats;
>   	struct dentry *debugfs_q_instance;
> -	struct dentry *debugfs_q_stats;
>   	int i;
>   
>   	if (!debugfs_initialized())
> @@ -299,24 +296,14 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
>   	if (!ccp_debugfs_dir)
>   		ccp_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
>   	mutex_unlock(&ccp_debugfs_lock);
> -	if (!ccp_debugfs_dir)
> -		return;
>   
>   	ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir);
> -	if (!ccp->debugfs_instance)
> -		goto err;
>   
> -	debugfs_info = debugfs_create_file("info", 0400,
> -					   ccp->debugfs_instance, ccp,
> -					   &ccp_debugfs_info_ops);
> -	if (!debugfs_info)
> -		goto err;
> +	debugfs_create_file("info", 0400, ccp->debugfs_instance, ccp,
> +			    &ccp_debugfs_info_ops);
>   
> -	debugfs_stats = debugfs_create_file("stats", 0600,
> -					    ccp->debugfs_instance, ccp,
> -					    &ccp_debugfs_stats_ops);
> -	if (!debugfs_stats)
> -		goto err;
> +	debugfs_create_file("stats", 0600, ccp->debugfs_instance, ccp,
> +			    &ccp_debugfs_stats_ops);
>   
>   	for (i = 0; i < ccp->cmd_q_count; i++) {
>   		cmd_q = &ccp->cmd_q[i];
> @@ -325,21 +312,12 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
>   
>   		debugfs_q_instance =
>   			debugfs_create_dir(name, ccp->debugfs_instance);
> -		if (!debugfs_q_instance)
> -			goto err;
> -
> -		debugfs_q_stats =
> -			debugfs_create_file("stats", 0600,
> -					    debugfs_q_instance, cmd_q,
> -					    &ccp_debugfs_queue_ops);
> -		if (!debugfs_q_stats)
> -			goto err;
> +
> +		debugfs_create_file("stats", 0600, debugfs_q_instance, cmd_q,
> +				    &ccp_debugfs_queue_ops);
>   	}
>   
>   	return;
> -
> -err:
> -	debugfs_remove_recursive(ccp->debugfs_instance);
>   }
>   
>   void ccp5_debugfs_destroy(void)
> 


  reply	other threads:[~2019-01-22 22:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:14 [PATCH 0/7] crypto: cleanup debugfs usage Greg Kroah-Hartman
2019-01-22 15:14 ` [PATCH 1/7] crypto: qat: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-22 15:14 ` [PATCH 2/7] crypto: ccrree: " Greg Kroah-Hartman
2019-01-23 12:58   ` Gilad Ben-Yossef
2019-01-23 13:37     ` Greg Kroah-Hartman
2019-01-24  7:58       ` Gilad Ben-Yossef
2019-01-22 15:14 ` [PATCH 3/7] crypto: axis: " Greg Kroah-Hartman
2019-01-23  7:37   ` Lars Persson
2019-01-22 15:14 ` [PATCH 4/7] crypto: cavium: zip: " Greg Kroah-Hartman
2019-01-23 13:30   ` Jan Glauber
2019-01-22 15:14 ` [PATCH 5/7] crypto: cavium: nitrox: " Greg Kroah-Hartman
2019-01-22 15:14 ` [PATCH 6/7] crypto: ccp: " Greg Kroah-Hartman
2019-01-22 22:06   ` Gary R Hook [this message]
2019-01-23  6:55     ` Greg Kroah-Hartman
2019-01-22 15:14 ` [PATCH 7/7] crypto: caam: " Greg Kroah-Hartman
2019-01-22 15:29   ` Horia Geanta
2019-02-01  6:48 ` [PATCH 0/7] crypto: cleanup debugfs usage Herbert Xu

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=1330d284-560a-5e09-6d15-50da354d0da2@amd.com \
    --to=ghook@amd.com \
    --cc=Gary.Hook@amd.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --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;
as well as URLs for NNTP newsgroup(s).