Skip to contentSkip to conversation

net: hns3: avoid -Wpointer-bool-conversion warning

PATCH Applied Arnd Bergmann 3 participants 3 messages Feb 4, 2021 – Feb 5, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: hns3: avoid -Wpointer-bool-conversion warning

From: Arnd Bergmann <[email protected]>

clang points out a redundant sanity check:

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:497:28: error: address of array 'filp->f_path.dentry->d_iname' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

This can never fail, so just remove the check.

Fixes 04987ca1b9b6 ("net: hns3: add debugfs support for tm nodes, priority and qset info")
---
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +0 -3
index 6978304f1ac5..c5958754f939 100644
@@ -494,9 +494,6 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
 	ssize_t size = 0;
 	int ret = 0;
 
-	if (!filp->f_path.dentry->d_iname)
-		return -EINVAL;
-
 	read_buf = kzalloc(HNS3_DBG_READ_LEN, GFP_KERNEL);
 	if (!read_buf)
 		return -ENOMEM;
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

clang points out a redundant sanity check:

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:497:28: error: address of array 'filp->f_path.dentry->d_iname' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

This can never fail, so just remove the check.

Fixes 04987ca1b9b6 ("net: hns3: add debugfs support for tm nodes, priority and qset info")
Quoted 21 lines
---
 drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +0 -3
index 6978304f1ac5..c5958754f939 100644
@@ -494,9 +494,6 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
 	ssize_t size = 0;
 	int ret = 0;
 
-	if (!filp->f_path.dentry->d_iname)
-		return -EINVAL;
-
 	read_buf = kzalloc(HNS3_DBG_READ_LEN, GFP_KERNEL);
 	if (!read_buf)
 		return -ENOMEM;
Signature · 1 line
2.29.2
#2 lore raw
In reply to Arnd Bergmann
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 9 lines · On Thu, 4 Feb 2021 16:38:06 +0100 you wrote:

From: Arnd Bergmann <[email protected]>

clang points out a redundant sanity check:

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:497:28: error: address of array 'filp->f_path.dentry->d_iname' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

This can never fail, so just remove the check.

[...]

Here is the summary with links:
- net: hns3: avoid -Wpointer-bool-conversion warning

    https://git.kernel.org/netdev/net-next/c/8f8a42ff003a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html