]> git.baikalelectronics.ru Git - kernel.git/commit
iavf: stop leaking iavf_status as "errno" values
authorMateusz Palczewski <mateusz.palczewski@intel.com>
Thu, 27 Jan 2022 14:16:29 +0000 (15:16 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 1 Mar 2022 16:50:11 +0000 (08:50 -0800)
commit0fde5b7e8f4617ba447fea917db7c71cd784da8c
tree132ec601a66f32f5fe9010f9a51aefff60bea4bf
parent2488e7226bbffb92b3385494e0acae0c2b239a5f
iavf: stop leaking iavf_status as "errno" values

Several functions in the iAVF core files take status values of the enum
iavf_status and convert them into integer values. This leads to
confusion as functions return both Linux errno values and status codes
intermixed. Reporting status codes as if they were "errno" values can
lead to confusion when reviewing error logs. Additionally, it can lead
to unexpected behavior if a return value is not interpreted properly.

Fix this by introducing iavf_status_to_errno, a switch that explicitly
converts from the status codes into an appropriate error value. Also
introduce a virtchnl_status_to_errno function for the one case where we
were returning both virtchnl status codes and iavf_status codes in the
same function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/iavf/iavf.h
drivers/net/ethernet/intel/iavf/iavf_main.c
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c