qed: Add a missing error code
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 3 Apr 2017 18:25:22 +0000 (21:25 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Apr 2017 13:53:42 +0000 (06:53 -0700)
We should be returning -ENOMEM if qed_mcp_cmd_add_elem() fails.  The
current code returns success.

Fixes: 4ed1eea82a21 ("qed: Revise MFW command locking")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Tomer Tayar <Tomer.Tayar@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed_mcp.c

index 619eac845028d99db205acc51cbf09da3c3a679d..ff6080df2246d3957bf80f5c0a708dbae4e53141 100644 (file)
@@ -455,8 +455,10 @@ _qed_mcp_cmd_and_union(struct qed_hwfn *p_hwfn,
        qed_mcp_reread_offsets(p_hwfn, p_ptt);
        seq_num = ++p_hwfn->mcp_info->drv_mb_seq;
        p_cmd_elem = qed_mcp_cmd_add_elem(p_hwfn, p_mb_params, seq_num);
-       if (!p_cmd_elem)
+       if (!p_cmd_elem) {
+               rc = -ENOMEM;
                goto err;
+       }
 
        __qed_mcp_cmd_and_union(p_hwfn, p_ptt, p_mb_params, seq_num);
        spin_unlock_bh(&p_hwfn->mcp_info->cmd_lock);