From: Andrew Lunn <andrew@lunn.ch>
To: cgel.zte@gmail.com
Cc: f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Lv Ruyi <lv.ruyi@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: fix error check return value of debugfs_create_dir()
Date: Tue, 19 Apr 2022 14:03:30 +0200 [thread overview]
Message-ID: <Yl6lEsruT1pJ+ir8@lunn.ch> (raw)
In-Reply-To: <20220419014056.2561750-1-lv.ruyi@zte.com.cn>
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
next prev parent reply other threads:[~2022-04-19 12:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-19 1:58 cgel.zte
2022-04-19 21:55 ` Andrew Lunn
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=Yl6lEsruT1pJ+ir8@lunn.ch \
--to=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cgel.zte@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lv.ruyi@zte.com.cn \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zealci@zte.com.cn \
/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