IB/ocrdma: fix incorrect fall-through on switch statement
authorColin Ian King <colin.king@canonical.com>
Mon, 11 Sep 2017 16:03:13 +0000 (17:03 +0100)
committerDoug Ledford <dledford@redhat.com>
Fri, 22 Sep 2017 17:16:00 +0000 (13:16 -0400)
In the case where mbox_status is OCRDMA_MBX_STATUS_FAILED and
add_status is OCRDMA_MBX_STATUS_FAILED err_num is assigned -EAGAIN
however the case OCRDMA_MBX_STATUS_FAILED is missing a break and
falls through to the default case which then re-assigns err_num
to -EFAULT.   Fix this so that err_num is assigned to -EAGAIN
for the add_status OCRDMA_MBX_STATUS_FAILED case and -EFAULT
otherwise.

Detected by CoverityScan CID#703125 ("Missing break in switch")

Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/ocrdma/ocrdma_hw.c

index dcb5942f9fb5a830f37e1757dd64cc0d836523b9..65b166cc743748fde5f89153dd96ed1950abb762 100644 (file)
@@ -252,7 +252,10 @@ static int ocrdma_get_mbx_errno(u32 status)
                case OCRDMA_MBX_ADDI_STATUS_INSUFFICIENT_RESOURCES:
                        err_num = -EAGAIN;
                        break;
+               default:
+                       err_num = -EFAULT;
                }
+               break;
        default:
                err_num = -EFAULT;
        }