Skip to content

Commit 83b49e7

Browse files
mswiatkoanguy11
authored andcommitted
ice: check if VF exists before mode check
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]>
1 parent 387d42a commit 83b49e7

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
@@ -1341,15 +1341,15 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted)
13411341
struct ice_vf *vf;
13421342
int ret;
13431343

1344+
vf = ice_get_vf_by_id(pf, vf_id);
1345+
if (!vf)
1346+
return -EINVAL;
1347+
13441348
if (ice_is_eswitch_mode_switchdev(pf)) {
13451349
dev_info(ice_pf_to_dev(pf), "Trusted VF is forbidden in switchdev mode\n");
13461350
return -EOPNOTSUPP;
13471351
}
13481352

1349-
vf = ice_get_vf_by_id(pf, vf_id);
1350-
if (!vf)
1351-
return -EINVAL;
1352-
13531353
ret = ice_check_vf_ready_for_cfg(vf);
13541354
if (ret)
13551355
goto out_put_vf;

0 commit comments

Comments
 (0)