Skip to content

Commit

Permalink
qlogic: qed: fix error codes in qed_resc_alloc()
Browse files Browse the repository at this point in the history
We accidentally return success instead of -ENOMEM here.

Fixes: fe56b9e ('qed: Add module with basic common support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Nov 5, 2015
1 parent e79a8bc commit 9b15acb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/net/ethernet/qlogic/qed/qed_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,15 @@ int qed_resc_alloc(struct qed_dev *cdev)
if (!p_hwfn->p_tx_cids) {
DP_NOTICE(p_hwfn,
"Failed to allocate memory for Tx Cids\n");
rc = -ENOMEM;
goto alloc_err;
}

p_hwfn->p_rx_cids = kzalloc(rx_size, GFP_KERNEL);
if (!p_hwfn->p_rx_cids) {
DP_NOTICE(p_hwfn,
"Failed to allocate memory for Rx Cids\n");
rc = -ENOMEM;
goto alloc_err;
}
}
Expand Down Expand Up @@ -281,14 +283,17 @@ int qed_resc_alloc(struct qed_dev *cdev)

/* EQ */
p_eq = qed_eq_alloc(p_hwfn, 256);

if (!p_eq)
if (!p_eq) {
rc = -ENOMEM;
goto alloc_err;
}
p_hwfn->p_eq = p_eq;

p_consq = qed_consq_alloc(p_hwfn);
if (!p_consq)
if (!p_consq) {
rc = -ENOMEM;
goto alloc_err;
}
p_hwfn->p_consq = p_consq;

/* DMA info initialization */
Expand All @@ -303,6 +308,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
cdev->reset_stats = kzalloc(sizeof(*cdev->reset_stats), GFP_KERNEL);
if (!cdev->reset_stats) {
DP_NOTICE(cdev, "Failed to allocate reset statistics\n");
rc = -ENOMEM;
goto alloc_err;
}

Expand Down

0 comments on commit 9b15acb

Please sign in to comment.