* [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions
@ 2019-12-09 15:21 Greg Kroah-Hartman
2019-12-10 4:05 ` Zhou Wang
2019-12-20 7:05 ` Herbert Xu
0 siblings, 2 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-09 15:21 UTC (permalink / raw)
To: Zhou Wang, Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel
Just like in 4a97bfc79619 ("crypto: hisilicon - no need to check return
value of debugfs_create functions"), there still 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.
Cc: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/crypto/hisilicon/hpre/hpre_main.c | 28 +++++------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c
index 34e0424410bf..711f5d18b641 100644
--- a/drivers/crypto/hisilicon/hpre/hpre_main.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
@@ -557,7 +557,7 @@ static const struct file_operations hpre_ctrl_debug_fops = {
static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
enum hpre_ctrl_dbgfs_file type, int indx)
{
- struct dentry *tmp, *file_dir;
+ struct dentry *file_dir;
if (dir)
file_dir = dir;
@@ -571,10 +571,8 @@ static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
dbg->files[indx].debug = dbg;
dbg->files[indx].type = type;
dbg->files[indx].index = indx;
- tmp = debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
- dbg->files + indx, &hpre_ctrl_debug_fops);
- if (!tmp)
- return -ENOENT;
+ debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
+ dbg->files + indx, &hpre_ctrl_debug_fops);
return 0;
}
@@ -585,7 +583,6 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
struct hisi_qm *qm = &hpre->qm;
struct device *dev = &qm->pdev->dev;
struct debugfs_regset32 *regset;
- struct dentry *tmp;
regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
if (!regset)
@@ -595,10 +592,7 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
regset->nregs = ARRAY_SIZE(hpre_com_dfx_regs);
regset->base = qm->io_base;
- tmp = debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
- if (!tmp)
- return -ENOENT;
-
+ debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
return 0;
}
@@ -609,15 +603,12 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
struct device *dev = &qm->pdev->dev;
char buf[HPRE_DBGFS_VAL_MAX_LEN];
struct debugfs_regset32 *regset;
- struct dentry *tmp_d, *tmp;
+ struct dentry *tmp_d;
int i, ret;
for (i = 0; i < HPRE_CLUSTERS_NUM; i++) {
sprintf(buf, "cluster%d", i);
-
tmp_d = debugfs_create_dir(buf, debug->debug_root);
- if (!tmp_d)
- return -ENOENT;
regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
if (!regset)
@@ -627,9 +618,7 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
regset->nregs = ARRAY_SIZE(hpre_cluster_dfx_regs);
regset->base = qm->io_base + hpre_cluster_offsets[i];
- tmp = debugfs_create_regset32("regs", 0444, tmp_d, regset);
- if (!tmp)
- return -ENOENT;
+ debugfs_create_regset32("regs", 0444, tmp_d, regset);
ret = hpre_create_debugfs_file(debug, tmp_d, HPRE_CLUSTER_CTRL,
i + HPRE_CLUSTER_CTRL);
if (ret)
@@ -668,9 +657,6 @@ static int hpre_debugfs_init(struct hpre *hpre)
int ret;
dir = debugfs_create_dir(dev_name(dev), hpre_debugfs_root);
- if (!dir)
- return -ENOENT;
-
qm->debug.debug_root = dir;
ret = hisi_qm_debug_init(qm);
@@ -1014,8 +1000,6 @@ static void hpre_register_debugfs(void)
return;
hpre_debugfs_root = debugfs_create_dir(hpre_name, NULL);
- if (IS_ERR_OR_NULL(hpre_debugfs_root))
- hpre_debugfs_root = NULL;
}
static void hpre_unregister_debugfs(void)
--
2.24.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions
2019-12-09 15:21 [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-12-10 4:05 ` Zhou Wang
2019-12-10 6:19 ` Xu Zaibo
2019-12-20 7:05 ` Herbert Xu
1 sibling, 1 reply; 4+ messages in thread
From: Zhou Wang @ 2019-12-10 4:05 UTC (permalink / raw)
To: Greg Kroah-Hartman, Herbert Xu, Xu Zaibo
Cc: David S. Miller, linux-crypto, linux-kernel
On 2019/12/9 23:21, Greg Kroah-Hartman wrote:
> Just like in 4a97bfc79619 ("crypto: hisilicon - no need to check return
> value of debugfs_create functions"), there still 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.
Thanks for fix this, +To Zaibo Xu who is the maintainer of this module :)
Best,
Zhou
>
> Cc: Zhou Wang <wangzhou1@hisilicon.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/crypto/hisilicon/hpre/hpre_main.c | 28 +++++------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c
> index 34e0424410bf..711f5d18b641 100644
> --- a/drivers/crypto/hisilicon/hpre/hpre_main.c
> +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
> @@ -557,7 +557,7 @@ static const struct file_operations hpre_ctrl_debug_fops = {
> static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
> enum hpre_ctrl_dbgfs_file type, int indx)
> {
> - struct dentry *tmp, *file_dir;
> + struct dentry *file_dir;
>
> if (dir)
> file_dir = dir;
> @@ -571,10 +571,8 @@ static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
> dbg->files[indx].debug = dbg;
> dbg->files[indx].type = type;
> dbg->files[indx].index = indx;
> - tmp = debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
> - dbg->files + indx, &hpre_ctrl_debug_fops);
> - if (!tmp)
> - return -ENOENT;
> + debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
> + dbg->files + indx, &hpre_ctrl_debug_fops);
>
> return 0;
> }
> @@ -585,7 +583,6 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
> struct hisi_qm *qm = &hpre->qm;
> struct device *dev = &qm->pdev->dev;
> struct debugfs_regset32 *regset;
> - struct dentry *tmp;
>
> regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
> if (!regset)
> @@ -595,10 +592,7 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
> regset->nregs = ARRAY_SIZE(hpre_com_dfx_regs);
> regset->base = qm->io_base;
>
> - tmp = debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
> - if (!tmp)
> - return -ENOENT;
> -
> + debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
> return 0;
> }
>
> @@ -609,15 +603,12 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
> struct device *dev = &qm->pdev->dev;
> char buf[HPRE_DBGFS_VAL_MAX_LEN];
> struct debugfs_regset32 *regset;
> - struct dentry *tmp_d, *tmp;
> + struct dentry *tmp_d;
> int i, ret;
>
> for (i = 0; i < HPRE_CLUSTERS_NUM; i++) {
> sprintf(buf, "cluster%d", i);
> -
> tmp_d = debugfs_create_dir(buf, debug->debug_root);
> - if (!tmp_d)
> - return -ENOENT;
>
> regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
> if (!regset)
> @@ -627,9 +618,7 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
> regset->nregs = ARRAY_SIZE(hpre_cluster_dfx_regs);
> regset->base = qm->io_base + hpre_cluster_offsets[i];
>
> - tmp = debugfs_create_regset32("regs", 0444, tmp_d, regset);
> - if (!tmp)
> - return -ENOENT;
> + debugfs_create_regset32("regs", 0444, tmp_d, regset);
> ret = hpre_create_debugfs_file(debug, tmp_d, HPRE_CLUSTER_CTRL,
> i + HPRE_CLUSTER_CTRL);
> if (ret)
> @@ -668,9 +657,6 @@ static int hpre_debugfs_init(struct hpre *hpre)
> int ret;
>
> dir = debugfs_create_dir(dev_name(dev), hpre_debugfs_root);
> - if (!dir)
> - return -ENOENT;
> -
> qm->debug.debug_root = dir;
>
> ret = hisi_qm_debug_init(qm);
> @@ -1014,8 +1000,6 @@ static void hpre_register_debugfs(void)
> return;
>
> hpre_debugfs_root = debugfs_create_dir(hpre_name, NULL);
> - if (IS_ERR_OR_NULL(hpre_debugfs_root))
> - hpre_debugfs_root = NULL;
> }
>
> static void hpre_unregister_debugfs(void)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions
2019-12-10 4:05 ` Zhou Wang
@ 2019-12-10 6:19 ` Xu Zaibo
0 siblings, 0 replies; 4+ messages in thread
From: Xu Zaibo @ 2019-12-10 6:19 UTC (permalink / raw)
To: Zhou Wang, Greg Kroah-Hartman, Herbert Xu
Cc: David S. Miller, linux-crypto, linux-kernel
Okay, I will fix this, thanks.
Cheers,
Zaibo
.
On 2019/12/10 12:05, Zhou Wang wrote:
> On 2019/12/9 23:21, Greg Kroah-Hartman wrote:
>> Just like in 4a97bfc79619 ("crypto: hisilicon - no need to check return
>> value of debugfs_create functions"), there still 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.
> Thanks for fix this, +To Zaibo Xu who is the maintainer of this module :)
>
> Best,
> Zhou
>
>> Cc: Zhou Wang <wangzhou1@hisilicon.com>
>> Cc: Herbert Xu <herbert@gondor.apana.org.au>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: linux-crypto@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>> drivers/crypto/hisilicon/hpre/hpre_main.c | 28 +++++------------------
>> 1 file changed, 6 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c
>> index 34e0424410bf..711f5d18b641 100644
>> --- a/drivers/crypto/hisilicon/hpre/hpre_main.c
>> +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
>> @@ -557,7 +557,7 @@ static const struct file_operations hpre_ctrl_debug_fops = {
>> static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
>> enum hpre_ctrl_dbgfs_file type, int indx)
>> {
>> - struct dentry *tmp, *file_dir;
>> + struct dentry *file_dir;
>>
>> if (dir)
>> file_dir = dir;
>> @@ -571,10 +571,8 @@ static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
>> dbg->files[indx].debug = dbg;
>> dbg->files[indx].type = type;
>> dbg->files[indx].index = indx;
>> - tmp = debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
>> - dbg->files + indx, &hpre_ctrl_debug_fops);
>> - if (!tmp)
>> - return -ENOENT;
>> + debugfs_create_file(hpre_debug_file_name[type], 0600, file_dir,
>> + dbg->files + indx, &hpre_ctrl_debug_fops);
>>
>> return 0;
>> }
>> @@ -585,7 +583,6 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
>> struct hisi_qm *qm = &hpre->qm;
>> struct device *dev = &qm->pdev->dev;
>> struct debugfs_regset32 *regset;
>> - struct dentry *tmp;
>>
>> regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
>> if (!regset)
>> @@ -595,10 +592,7 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
>> regset->nregs = ARRAY_SIZE(hpre_com_dfx_regs);
>> regset->base = qm->io_base;
>>
>> - tmp = debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
>> - if (!tmp)
>> - return -ENOENT;
>> -
>> + debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
>> return 0;
>> }
>>
>> @@ -609,15 +603,12 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
>> struct device *dev = &qm->pdev->dev;
>> char buf[HPRE_DBGFS_VAL_MAX_LEN];
>> struct debugfs_regset32 *regset;
>> - struct dentry *tmp_d, *tmp;
>> + struct dentry *tmp_d;
>> int i, ret;
>>
>> for (i = 0; i < HPRE_CLUSTERS_NUM; i++) {
>> sprintf(buf, "cluster%d", i);
>> -
>> tmp_d = debugfs_create_dir(buf, debug->debug_root);
>> - if (!tmp_d)
>> - return -ENOENT;
>>
>> regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
>> if (!regset)
>> @@ -627,9 +618,7 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
>> regset->nregs = ARRAY_SIZE(hpre_cluster_dfx_regs);
>> regset->base = qm->io_base + hpre_cluster_offsets[i];
>>
>> - tmp = debugfs_create_regset32("regs", 0444, tmp_d, regset);
>> - if (!tmp)
>> - return -ENOENT;
>> + debugfs_create_regset32("regs", 0444, tmp_d, regset);
>> ret = hpre_create_debugfs_file(debug, tmp_d, HPRE_CLUSTER_CTRL,
>> i + HPRE_CLUSTER_CTRL);
>> if (ret)
>> @@ -668,9 +657,6 @@ static int hpre_debugfs_init(struct hpre *hpre)
>> int ret;
>>
>> dir = debugfs_create_dir(dev_name(dev), hpre_debugfs_root);
>> - if (!dir)
>> - return -ENOENT;
>> -
>> qm->debug.debug_root = dir;
>>
>> ret = hisi_qm_debug_init(qm);
>> @@ -1014,8 +1000,6 @@ static void hpre_register_debugfs(void)
>> return;
>>
>> hpre_debugfs_root = debugfs_create_dir(hpre_name, NULL);
>> - if (IS_ERR_OR_NULL(hpre_debugfs_root))
>> - hpre_debugfs_root = NULL;
>> }
>>
>> static void hpre_unregister_debugfs(void)
>>
> .
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions
2019-12-09 15:21 [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-12-10 4:05 ` Zhou Wang
@ 2019-12-20 7:05 ` Herbert Xu
1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2019-12-20 7:05 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Zhou Wang, David S. Miller, linux-crypto, linux-kernel
On Mon, Dec 09, 2019 at 04:21:51PM +0100, Greg Kroah-Hartman wrote:
> Just like in 4a97bfc79619 ("crypto: hisilicon - no need to check return
> value of debugfs_create functions"), there still 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.
>
> Cc: Zhou Wang <wangzhou1@hisilicon.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/crypto/hisilicon/hpre/hpre_main.c | 28 +++++------------------
> 1 file changed, 6 insertions(+), 22 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-20 7:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 15:21 [PATCH] crypto: hisilicon - still no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-12-10 4:05 ` Zhou Wang
2019-12-10 6:19 ` Xu Zaibo
2019-12-20 7:05 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.