ice: cleanup error logging for ice_ena_vfs
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 23 Feb 2022 00:26:56 +0000 (16:26 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 15 Mar 2022 00:22:59 +0000 (17:22 -0700)
commit94ab2488d467e69d1216bad97a5839afb3b805c3
tree11fce9389a20b3360c287604cf1d2aef66947ebd
parent346f7aa3c7733d5dcbfd31d439822a22fcfedac9
ice: cleanup error logging for ice_ena_vfs

The ice_ena_vfs function and some of its sub-functions like
ice_set_per_vf_res use a "if (<function>) { <print error> ; <exit> }"
flow. This flow discards specialized errors reported by the called
function.

This style is generally not preferred as it makes tracing error sources
more difficult. It also means we cannot log the actual error received
properly.

Refactor several calls in the ice_ena_vfs function that do this to catch
the error in the 'ret' variable. Report this in the messages, and then
return the more precise error value.

Doing this reveals that ice_set_per_vf_res returns -EINVAL or -EIO in
places where -ENOSPC makes more sense. Fix these calls up to return the
more appropriate value.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_sriov.c