* [PATCH net-next v2] bnx2x: remove redundant NULL-pointer check
@ 2024-10-25 17:42 Nikita Kiryushin
2024-11-01 1:32 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Nikita Kiryushin @ 2024-10-25 17:42 UTC (permalink / raw)
To: Sudarsana Kalluru
Cc: Nikita Kiryushin, Manish Chopra, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
lvc-project
bnx2x_get_vf_config() contains NULL-pointer checks for
mac_obj and vlan_obj.
The fields checked are assigned to (after macro expansions):
mac_obj = &((vf)->vfqs[0].mac_obj);
vlan_obj = &((vf)->vfqs[0].vlan_obj);
It is impossible to get NULL for those.
Remove superfluous NULL-pointer check and associated
unreachable code to improve readability.
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
v2:
- remove confusing part of commit message as Simon Horman <horms@kernel.org>
suggested in https://lore.kernel.org/lkml/20240715181029.GD249423@kernel.org/
v1: https://lore.kernel.org/lkml/20240712185431.81805-1-kiryushin@ancud.ru/
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 12198fc3ab22..0f121b15f5d7 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2619,10 +2619,6 @@ int bnx2x_get_vf_config(struct net_device *dev, int vfidx,
mac_obj = &bnx2x_leading_vfq(vf, mac_obj);
vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj);
- if (!mac_obj || !vlan_obj) {
- BNX2X_ERR("VF partially initialized\n");
- return -EINVAL;
- }
ivi->vf = vfidx;
ivi->qos = 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] bnx2x: remove redundant NULL-pointer check
2024-10-25 17:42 [PATCH net-next v2] bnx2x: remove redundant NULL-pointer check Nikita Kiryushin
@ 2024-11-01 1:32 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-11-01 1:32 UTC (permalink / raw)
To: Nikita Kiryushin
Cc: Sudarsana Kalluru, Manish Chopra, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, netdev, linux-kernel, lvc-project
On Fri, 25 Oct 2024 20:42:03 +0300 Nikita Kiryushin wrote:
> bnx2x_get_vf_config() contains NULL-pointer checks for
> mac_obj and vlan_obj.
>
> The fields checked are assigned to (after macro expansions):
>
> mac_obj = &((vf)->vfqs[0].mac_obj);
> vlan_obj = &((vf)->vfqs[0].vlan_obj);
>
> It is impossible to get NULL for those.
>
> Remove superfluous NULL-pointer check and associated
> unreachable code to improve readability.
this is an old driver and the 4 saved LoC on the control path
don't seem to justify the review effort needed, anyway, sorry.
--
pw-bot: reject
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-01 1:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 17:42 [PATCH net-next v2] bnx2x: remove redundant NULL-pointer check Nikita Kiryushin
2024-11-01 1:32 ` Jakub Kicinski
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).