aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca
diff options
context:
space:
mode:
authorOlaf Kirch <olaf.kirch@oracle.com>2008-02-04 23:20:44 -0500
committerRoland Dreier <rolandd@cisco.com>2008-02-04 23:20:44 -0500
commit2c78853472a36c7cf51a84a34edc370e21c93ce4 (patch)
treea89ab43cc596415f80e434470595fcbb4f8e7544 /drivers/infiniband/hw/mthca
parentf33afc26dc03e6e0513e2e300f2aa0ad5463c2d2 (diff)
IB/mthca: Return proper error codes from mthca_fmr_alloc()
If the allocation of the MTT or the mailbox failed, mthca_fmr_alloc() would return 0 (success) no matter what. This leads to crashes a little down the road, when we try to dereference eg mr->mtt, which was really ERR_PTR(-Ewhatever). Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mthca')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index aa6c70a6a36f..3b6985557cb2 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -613,8 +613,10 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
613 sizeof *(mr->mem.tavor.mpt) * idx; 613 sizeof *(mr->mem.tavor.mpt) * idx;
614 614
615 mr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy); 615 mr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy);
616 if (IS_ERR(mr->mtt)) 616 if (IS_ERR(mr->mtt)) {
617 err = PTR_ERR(mr->mtt);
617 goto err_out_table; 618 goto err_out_table;
619 }
618 620
619 mtt_seg = mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE; 621 mtt_seg = mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE;
620 622
@@ -627,8 +629,10 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
627 mr->mem.tavor.mtts = dev->mr_table.tavor_fmr.mtt_base + mtt_seg; 629 mr->mem.tavor.mtts = dev->mr_table.tavor_fmr.mtt_base + mtt_seg;
628 630
629 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); 631 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
630 if (IS_ERR(mailbox)) 632 if (IS_ERR(mailbox)) {
633 err = PTR_ERR(mailbox);
631 goto err_out_free_mtt; 634 goto err_out_free_mtt;
635 }
632 636
633 mpt_entry = mailbox->buf; 637 mpt_entry = mailbox->buf;
634 638