Re: [PATCH net-next v2 1/5] qlcnic: Return appropriate error code.
From: David Miller <davem@davemloft.net>
Date: 2013-08-01 00:22:15
From: Himanshu Madhani <redacted> Date: Wed, 31 Jul 2013 17:10:58 -0400
quoted hunk ↗ jump to hunk
@@ -952,10 +952,11 @@ struct qlcnic_ipaddr { #define QLCNIC_LB_BUCKET_SIZE 32 /* QLCNIC Driver Error Code */ -#define QLCNIC_FW_NOT_RESPOND 51 +#define QLCNIC_FW_RESPONSE_TIMEOUT 51 #define QLCNIC_TEST_IN_PROGRESS 52 #define QLCNIC_UNDEFINED_ERROR 53 #define QLCNIC_LB_CABLE_NOT_CONN 54 +#define QLCNIC_LB_IN_PROGRESS 55 #define QLCNIC_ILB_MAX_RCV_LOOP 10 struct qlcnic_filter {
...
quoted hunk ↗ jump to hunk
@@ -1686,13 +1686,13 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { netdev_info(netdev, "Device is resetting, free LB test resources\n"); - ret = -EIO; + ret = -EBUSY; goto free_diag_res; } if (loop++ > QLC_83XX_LB_WAIT_COUNT) { netdev_info(netdev, "Firmware didn't sent link up event to loopback request\n"); - ret = -QLCNIC_FW_NOT_RESPOND; + ret = -QLCNIC_FW_RESPONSE_TIMEOUT; qlcnic_83xx_clear_lb_mode(adapter, mode); goto free_diag_res; }
You absolutely cannot do error codes this way. It is not valid to arbitrarily mix standard E*** error codes with custom ones you've defined in this driver such as QLCNIC_FW_RESPONSE_TIMEOUT. You have no idea what values EIO, EBUSY, etc. take on. They are in fact different on every single architecture. So they might overlap the values you've choosen for your custom errors. Either you use standard error codes for everything, or your own. I'm not applying these patches, sorry.