* [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
@ 2022-04-19 1:40 cgel.zte
2022-04-19 1:52 ` Lv Ruyi
2022-04-19 12:03 ` Andrew Lunn
0 siblings, 2 replies; 5+ messages in thread
From: cgel.zte @ 2022-04-19 1:40 UTC (permalink / raw)
To: f.fainelli, bcm-kernel-feedback-list, andrew
Cc: hkallweit1, linux, davem, kuba, pabeni, netdev, linux-kernel,
Lv Ruyi, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
so use IS_ERR() to check it.
Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
drivers/net/ethernet/mediatek/mtk_wed_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
index a81d3fd1a439..0c284c18a8d7 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
@@ -165,7 +165,7 @@ void mtk_wed_hw_add_debugfs(struct mtk_wed_hw *hw)
snprintf(hw->dirname, sizeof(hw->dirname), "wed%d", hw->index);
dir = debugfs_create_dir(hw->dirname, NULL);
- if (!dir)
+ if (IS_ERR(dir))
return;
hw->debugfs_dir = dir;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
2022-04-19 1:40 [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir() cgel.zte
@ 2022-04-19 1:52 ` Lv Ruyi
2022-04-19 12:03 ` Andrew Lunn
1 sibling, 0 replies; 5+ messages in thread
From: Lv Ruyi @ 2022-04-19 1:52 UTC (permalink / raw)
To: cgel.zte
Cc: andrew, bcm-kernel-feedback-list, davem, f.fainelli, hkallweit1,
kuba, linux-kernel, linux, lv.ruyi, netdev, pabeni, zealci
so sorry, please ignore the noise, I sent the mail to the wrong person.
Thanks
Lv Ruyi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
2022-04-19 1:40 [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir() cgel.zte
2022-04-19 1:52 ` Lv Ruyi
@ 2022-04-19 12:03 ` Andrew Lunn
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2022-04-19 12:03 UTC (permalink / raw)
To: cgel.zte
Cc: f.fainelli, bcm-kernel-feedback-list, hkallweit1, linux, davem,
kuba, pabeni, netdev, linux-kernel, Lv Ruyi, Zeal Robot
On Tue, Apr 19, 2022 at 01:40:56AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
> so use IS_ERR() to check it.
>
> Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
> drivers/net/ethernet/mediatek/mtk_wed_debugfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
> index a81d3fd1a439..0c284c18a8d7 100644
> --- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
> +++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
> @@ -165,7 +165,7 @@ void mtk_wed_hw_add_debugfs(struct mtk_wed_hw *hw)
>
> snprintf(hw->dirname, sizeof(hw->dirname), "wed%d", hw->index);
> dir = debugfs_create_dir(hw->dirname, NULL);
> - if (!dir)
> + if (IS_ERR(dir))
> return;
You should not check the return value from any debugfs calls.
If Zeal bot is saying you should, Zeal is broken/does not understand
debugfs.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
2022-04-19 1:58 cgel.zte
@ 2022-04-19 21:55 ` Andrew Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2022-04-19 21:55 UTC (permalink / raw)
To: cgel.zte
Cc: nbd, john, sean.wang, Mark-MC.Lee, davem, kuba, pabeni,
matthias.bgg, netdev, linux-arm-kernel, linux-mediatek,
linux-kernel, Lv Ruyi, Zeal Robot
On Tue, Apr 19, 2022 at 01:58:32AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
> so use IS_ERR() to check it.
Please take a look at for example:
https://lkml.iu.edu/hypermail/linux/kernel/1901.2/06005.html
https://lkml.iu.edu/hypermail/linux/kernel/1901.2/06006.html
https://lkml.iu.edu/hypermail/linux/kernel/1901.2/05993.html
This is the author of debugfs remove exactly the sort of code you are
adding.
Please teach the Zeal Bot that such code is wrong, and you should be
submitting patches to actually remove testing the return values for
anything which starts with debugfs_
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
@ 2022-04-19 1:58 cgel.zte
2022-04-19 21:55 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: cgel.zte @ 2022-04-19 1:58 UTC (permalink / raw)
To: nbd, john, sean.wang
Cc: Mark-MC.Lee, davem, kuba, pabeni, matthias.bgg, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel, Lv Ruyi,
Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR),
so use IS_ERR() to check it.
Fixes: 804775dfc288 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
drivers/net/ethernet/mediatek/mtk_wed_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
index a81d3fd1a439..0c284c18a8d7 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_debugfs.c
@@ -165,7 +165,7 @@ void mtk_wed_hw_add_debugfs(struct mtk_wed_hw *hw)
snprintf(hw->dirname, sizeof(hw->dirname), "wed%d", hw->index);
dir = debugfs_create_dir(hw->dirname, NULL);
- if (!dir)
+ if (IS_ERR(dir))
return;
hw->debugfs_dir = dir;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-19 21:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 1:40 [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir() cgel.zte
2022-04-19 1:52 ` Lv Ruyi
2022-04-19 12:03 ` Andrew Lunn
2022-04-19 1:58 cgel.zte
2022-04-19 21:55 ` Andrew Lunn
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).