net: hinic: simplify code logic
authorZhengchao Shao <shaozhengchao@huawei.com>
Wed, 21 Sep 2022 12:33:54 +0000 (20:33 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 23 Sep 2022 00:41:27 +0000 (17:41 -0700)
simplify code logic in hinic_ndo_set_vf_trust() and
hinic_ndo_set_vf_spoofchk().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/huawei/hinic/hinic_sriov.c

index a8f71a6..00a66e6 100644 (file)
@@ -820,7 +820,7 @@ int hinic_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
 
        cur_trust = nic_io->vf_infos[vf].trust;
        /* same request, so just return success */
-       if ((setting && cur_trust) || (!setting && !cur_trust))
+       if (setting == cur_trust)
                return 0;
 
        err = hinic_set_vf_trust(adapter->hwdev, vf, setting);
@@ -940,7 +940,7 @@ int hinic_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
        cur_spoofchk = nic_dev->hwdev->func_to_io.vf_infos[vf].spoofchk;
 
        /* same request, so just return success */
-       if ((setting && cur_spoofchk) || (!setting && !cur_spoofchk))
+       if (setting == cur_spoofchk)
                return 0;
 
        err = hinic_set_vf_spoofchk(sriov_info->hwdev,