net: ena: fix ena_com_comp_status_to_errno() return value
authorArthur Kiyanovski <akiyano@amazon.com>
Fri, 22 May 2020 09:08:55 +0000 (12:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 May 2020 21:12:48 +0000 (14:12 -0700)
Default return value should be -EINVAL since the input
in this case was unexpected.
Also remove the now redundant check in the beginning
of the function.

Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_com.c

index 02780f9fa586dacbed06a07635226c3b309dfe1d..921945dace223f367fcf1352b982112d249ed4e2 100644 (file)
@@ -523,9 +523,6 @@ static int ena_com_comp_status_to_errno(u8 comp_status)
        if (unlikely(comp_status != 0))
                pr_err("admin command failed[%u]\n", comp_status);
 
-       if (unlikely(comp_status > ENA_ADMIN_UNKNOWN_ERROR))
-               return -EINVAL;
-
        switch (comp_status) {
        case ENA_ADMIN_SUCCESS:
                return 0;
@@ -540,7 +537,7 @@ static int ena_com_comp_status_to_errno(u8 comp_status)
                return -EINVAL;
        }
 
-       return 0;
+       return -EINVAL;
 }
 
 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx,