net: ethtool: move checks before rtnl_lock() in ethnl_set_rings
authorJie Wang <wangjie125@huawei.com>
Tue, 12 Apr 2022 02:01:20 +0000 (10:01 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 15 Apr 2022 18:41:45 +0000 (11:41 -0700)
commitbde292c07b480e23137060dad83cca24d55c4cc4
tree5106c0fc4f46524cfc3d69f19c991ff4dad3de50
parent4dc84c06a343fcb95fd5a0acb537aefa4ebdd1b0
net: ethtool: move checks before rtnl_lock() in ethnl_set_rings

Currently these two checks in ethnl_set_rings are added after rtnl_lock()
which will do useless works if the request is invalid.

So this patch moves these checks before the rtnl_lock() to avoid these
costs.

Signed-off-by: Jie Wang <wangjie125@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/rings.c