Skip to content

Commit ad62a28

Browse files
mswiatkogregkh
authored andcommitted
ice: check if VF exists before mode check
[ Upstream commit 83b49e7 ] Setting trust on VF should return EINVAL when there is no VF. Move checking for switchdev mode after checking if VF exists. Fixes: c54d209 ("ice: Wait for VF to be reset/ready before configuration") Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Kalyan Kodamagula <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 90c229d commit ad62a28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/ethernet/intel/ice/ice_sriov.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,15 +1384,15 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
13841384
struct ice_vf *vf;
13851385
int ret;
13861386

1387+
vf = ice_get_vf_by_id(pf, vf_id);
1388+
if (!vf)
1389+
return -EINVAL;
1390+
13871391
if (ice_is_eswitch_mode_switchdev(pf)) {
13881392
dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n");
13891393
return -EOPNOTSUPP;
13901394
}
13911395

1392-
vf = ice_get_vf_by_id(pf, vf_id);
1393-
if (!vf)
1394-
return -EINVAL;
1395-
13961396
ret = ice_check_vf_ready_for_cfg(vf);
13971397
if (ret)
13981398
goto out_put_vf;

0 commit comments

Comments
 (0)