* [PATCH] cxgb4: Return an error code only as a constant in cxgb4_init_ethtool_filters()
@ 2025-04-23 6:35 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-04-23 6:35 UTC (permalink / raw)
To: netdev, Abdun Nihaal, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Potnuri Bharat Teja
Cc: LKML, Jacob Keller, Rahul Lakkireddy, Simon Horman, Vishal Kulkarni
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 23 Apr 2025 08:15:24 +0200
Return an error code without storing it in an intermediate variable.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
index 1546c3db08f0..fd4f6c146ad2 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
@@ -2238,7 +2238,6 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
struct cxgb4_ethtool_filter *eth_filter;
struct tid_info *tids = &adap->tids;
u32 nentries, i;
- int ret;
eth_filter = kzalloc(sizeof(*eth_filter), GFP_KERNEL);
if (!eth_filter)
@@ -2247,10 +2246,8 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
eth_filter_info = kcalloc(adap->params.nports,
sizeof(*eth_filter_info),
GFP_KERNEL);
- if (!eth_filter_info) {
- ret = -ENOMEM;
+ if (!eth_filter_info)
goto free_eth_filter;
- }
eth_filter->port = eth_filter_info;
@@ -2262,14 +2259,11 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
for (i = 0; i < adap->params.nports; i++) {
eth_filter->port[i].loc_array = kvzalloc(nentries, GFP_KERNEL);
- if (!eth_filter->port[i].loc_array) {
- ret = -ENOMEM;
+ if (!eth_filter->port[i].loc_array)
goto free_eth_finfo;
- }
eth_filter->port[i].bmap = bitmap_zalloc(nentries, GFP_KERNEL);
if (!eth_filter->port[i].bmap) {
- ret = -ENOMEM;
kvfree(eth_filter->port[i].loc_array);
goto free_eth_finfo;
}
@@ -2287,8 +2281,7 @@ int cxgb4_init_ethtool_filters(struct adapter *adap)
free_eth_filter:
kfree(eth_filter);
-
- return ret;
+ return -ENOMEM;
}
void cxgb4_set_ethtool_ops(struct net_device *netdev)
--
2.49.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-04-23 6:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-23 6:35 [PATCH] cxgb4: Return an error code only as a constant in cxgb4_init_ethtool_filters() Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®