Skip to content

Commit

Permalink
ethtool: fec_prepare_data() - jump to error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Apr 16, 2021
1 parent c5797f8 commit 3d7cc10
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/ethtool/fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
Expand Down

0 comments on commit 3d7cc10

Please sign in to comment.