* [PATCH v2] qed: remove an unneed NULL check on list iterator
@ 2022-04-06 1:59 Xiaomeng Tong
2022-04-08 4:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Xiaomeng Tong @ 2022-04-06 1:59 UTC (permalink / raw)
To: aelior, manishc, davem, kuba; +Cc: netdev, linux-kernel, Xiaomeng Tong
The define for_each_pci_dev(d) is:
while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
Thus, the list iterator 'd' is always non-NULL so it doesn't need to
be checked. So just remove the unnecessary NULL check. Also remove the
unnecessary initializer because the list iterator is always initialized.
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
---
changes since v1:
- adjust the order of variable declaration (Jakub Kicinski)
v1: https://lore.kernel.org/lkml/20220405002256.22772-1-xiam0nd.tong@gmail.com/
---
drivers/net/ethernet/qlogic/qed/qed_nvmetcp_ip_services.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_nvmetcp_ip_services.c b/drivers/net/ethernet/qlogic/qed/qed_nvmetcp_ip_services.c
index 96a2077fd315..7e286cddbedb 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_nvmetcp_ip_services.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_nvmetcp_ip_services.c
@@ -161,11 +161,11 @@ EXPORT_SYMBOL(qed_vlan_get_ndev);
struct pci_dev *qed_validate_ndev(struct net_device *ndev)
{
- struct pci_dev *pdev = NULL;
struct net_device *upper;
+ struct pci_dev *pdev;
for_each_pci_dev(pdev) {
- if (pdev && pdev->driver &&
+ if (pdev->driver &&
!strcmp(pdev->driver->name, "qede")) {
upper = pci_get_drvdata(pdev);
if (upper->ifindex == ndev->ifindex)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] qed: remove an unneed NULL check on list iterator
2022-04-06 1:59 [PATCH v2] qed: remove an unneed NULL check on list iterator Xiaomeng Tong
@ 2022-04-08 4:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-08 4:10 UTC (permalink / raw)
To: Xiaomeng Tong; +Cc: aelior, manishc, davem, kuba, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 6 Apr 2022 09:59:21 +0800 you wrote:
> The define for_each_pci_dev(d) is:
> while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
>
> Thus, the list iterator 'd' is always non-NULL so it doesn't need to
> be checked. So just remove the unnecessary NULL check. Also remove the
> unnecessary initializer because the list iterator is always initialized.
>
> [...]
Here is the summary with links:
- [v2] qed: remove an unneed NULL check on list iterator
https://git.kernel.org/netdev/net-next/c/4daf5f195630
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-08 4:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 1:59 [PATCH v2] qed: remove an unneed NULL check on list iterator Xiaomeng Tong
2022-04-08 4:10 ` patchwork-bot+netdevbpf
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.