* [patch -next] qlogic: qed: fix error codes in qed_resc_alloc()
@ 2015-11-05 8:41 Dan Carpenter
2015-11-05 9:01 ` Yuval Mintz
2015-11-05 18:40 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-11-05 8:41 UTC (permalink / raw)
To: Yuval Mintz; +Cc: Ariel Elior, everest-linux-l2, netdev, kernel-janitors
We accidentally return success instead of -ENOMEM here.
Fixes: fe56b9e6a8d9 ('qed: Add module with basic common support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index b9b7b7e..562e160 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -223,6 +223,7 @@ 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;
}
@@ -230,6 +231,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
if (!p_hwfn->p_rx_cids) {
DP_NOTICE(p_hwfn,
"Failed to allocate memory for Rx Cids\n");
+ rc = -ENOMEM;
goto alloc_err;
}
}
@@ -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 */
@@ -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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [patch -next] qlogic: qed: fix error codes in qed_resc_alloc()
2015-11-05 8:41 [patch -next] qlogic: qed: fix error codes in qed_resc_alloc() Dan Carpenter
@ 2015-11-05 9:01 ` Yuval Mintz
2015-11-05 18:40 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Yuval Mintz @ 2015-11-05 9:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ariel Elior, Dept-Eng Everest Linux L2, netdev,
kernel-janitors@vger.kernel.org
> We accidentally return success instead of -ENOMEM here.
>
> Fixes: fe56b9e6a8d9 ('qed: Add module with basic common support')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Thanks. Although you might also argue that it's good enough for this function
to always return -ENOMEM [given it's a resource allocation functions]
instead of bothering with setting 'rc' with correct error codes.
Regardless,
Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch -next] qlogic: qed: fix error codes in qed_resc_alloc()
2015-11-05 8:41 [patch -next] qlogic: qed: fix error codes in qed_resc_alloc() Dan Carpenter
2015-11-05 9:01 ` Yuval Mintz
@ 2015-11-05 18:40 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-11-05 18:40 UTC (permalink / raw)
To: dan.carpenter
Cc: Yuval.Mintz, Ariel.Elior, everest-linux-l2, netdev,
kernel-janitors
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 5 Nov 2015 11:41:28 +0300
> We accidentally return success instead of -ENOMEM here.
>
> Fixes: fe56b9e6a8d9 ('qed: Add module with basic common support')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks Dan.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-05 18:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-05 8:41 [patch -next] qlogic: qed: fix error codes in qed_resc_alloc() Dan Carpenter
2015-11-05 9:01 ` Yuval Mintz
2015-11-05 18:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).