kernel/patches/0589-ethtool-fec_prepare_data-jump-to-error-handling.patch
2023-11-17 14:19:46 +08:00

61 lines
1.8 KiB
Diff

From 0b24f8a8b5e8f3fb22b9dd58467eefb0fb641428 Mon Sep 17 00:00:00 2001
From: Jakub Kicinski <kuba@kernel.org>
Date: Thu, 15 Apr 2021 15:53:14 -0700
Subject: [PATCH 228/283] ethtool: fec_prepare_data() - jump to error handling
mainline inclusion
from mainline-v5.13-rc1
commit 3d7cc109ecf76afc74f40eb71d5c9baa03c167a3
category: cleanup
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8EN49
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3d7cc109ecf76afc74f40eb71d5c9baa03c167a3
--------------------------------
Refactor fec_prepare_data() a little bit to skip the body
of the function and exit on error. Currently the code
depends on the fact that we only have one call which
may fail between ethnl_ops_begin() and ethnl_ops_complete()
and simply saves the error code. This will get hairy with
the stats also being queried.
No functional changes.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Xiaodong Li <lixiaodong67@huawei.com>
---
net/ethtool/fec.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ethtool/fec.c b/net/ethtool/fec.c
index 31454b9188bd..3e7d091ee7aa 100644
--- a/net/ethtool/fec.c
+++ b/net/ethtool/fec.c
@@ -80,9 +80,8 @@ static int fec_prepare_data(const struct ethnl_req_info *req_base,
if (ret < 0)
return ret;
ret = dev->ethtool_ops->get_fecparam(dev, &fec);
- ethnl_ops_complete(dev);
if (ret)
- return ret;
+ goto out_complete;
WARN_ON_ONCE(fec.reserved);
@@ -98,7 +97,9 @@ static int fec_prepare_data(const struct ethnl_req_info *req_base,
if (data->active_fec == __ETHTOOL_LINK_MODE_MASK_NBITS)
data->active_fec = 0;
- return 0;
+out_complete:
+ ethnl_ops_complete(dev);
+ return ret;
}
static int fec_reply_size(const struct ethnl_req_info *req_base,
--
2.34.1