aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@linux.vnet.ibm.com>2008-04-29 16:46:52 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-29 16:46:52 -0400
commit7df109d917e85d3da2e25bd495c4997e87ed2a4e (patch)
tree6eac844aee0badb05ac40dbfe1b3fe142e9d9f09 /drivers/infiniband/hw
parentf8b0dfd15277974b5c9f3ff17f9e3ab6fdbe45ee (diff)
IB/ehca: handle negative return value from ibmebus_request_irq() properly
ehca_create_eq() was assigning a signed return value to an unsiged local variable and then checking if the variable was < 0, which meant that errors were always ignored. Fix this by using one variable for signed integer return values and another for u64 hcall return values. Bug originally found by Roel Kluin <12o3l@tiscali.nl>. Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_eq.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_eq.c b/drivers/infiniband/hw/ehca/ehca_eq.c
index b4ac617a70e6..49660dfa1867 100644
--- a/drivers/infiniband/hw/ehca/ehca_eq.c
+++ b/drivers/infiniband/hw/ehca/ehca_eq.c
@@ -54,7 +54,8 @@ int ehca_create_eq(struct ehca_shca *shca,
54 struct ehca_eq *eq, 54 struct ehca_eq *eq,
55 const enum ehca_eq_type type, const u32 length) 55 const enum ehca_eq_type type, const u32 length)
56{ 56{
57 u64 ret; 57 int ret;
58 u64 h_ret;
58 u32 nr_pages; 59 u32 nr_pages;
59 u32 i; 60 u32 i;
60 void *vpage; 61 void *vpage;
@@ -73,15 +74,15 @@ int ehca_create_eq(struct ehca_shca *shca,
73 return -EINVAL; 74 return -EINVAL;
74 } 75 }
75 76
76 ret = hipz_h_alloc_resource_eq(shca->ipz_hca_handle, 77 h_ret = hipz_h_alloc_resource_eq(shca->ipz_hca_handle,
77 &eq->pf, 78 &eq->pf,
78 type, 79 type,
79 length, 80 length,
80 &eq->ipz_eq_handle, 81 &eq->ipz_eq_handle,
81 &eq->length, 82 &eq->length,
82 &nr_pages, &eq->ist); 83 &nr_pages, &eq->ist);
83 84
84 if (ret != H_SUCCESS) { 85 if (h_ret != H_SUCCESS) {
85 ehca_err(ib_dev, "Can't allocate EQ/NEQ. eq=%p", eq); 86 ehca_err(ib_dev, "Can't allocate EQ/NEQ. eq=%p", eq);
86 return -EINVAL; 87 return -EINVAL;
87 } 88 }
@@ -97,24 +98,22 @@ int ehca_create_eq(struct ehca_shca *shca,
97 u64 rpage; 98 u64 rpage;
98 99
99 vpage = ipz_qpageit_get_inc(&eq->ipz_queue); 100 vpage = ipz_qpageit_get_inc(&eq->ipz_queue);
100 if (!vpage) { 101 if (!vpage)
101 ret = H_RESOURCE;
102 goto create_eq_exit2; 102 goto create_eq_exit2;
103 }
104 103
105 rpage = virt_to_abs(vpage); 104 rpage = virt_to_abs(vpage);
106 ret = hipz_h_register_rpage_eq(shca->ipz_hca_handle, 105 h_ret = hipz_h_register_rpage_eq(shca->ipz_hca_handle,
107 eq->ipz_eq_handle, 106 eq->ipz_eq_handle,
108 &eq->pf, 107 &eq->pf,
109 0, 0, rpage, 1); 108 0, 0, rpage, 1);
110 109
111 if (i == (nr_pages - 1)) { 110 if (i == (nr_pages - 1)) {
112 /* last page */ 111 /* last page */
113 vpage = ipz_qpageit_get_inc(&eq->ipz_queue); 112 vpage = ipz_qpageit_get_inc(&eq->ipz_queue);
114 if (ret != H_SUCCESS || vpage) 113 if (h_ret != H_SUCCESS || vpage)
115 goto create_eq_exit2; 114 goto create_eq_exit2;
116 } else { 115 } else {
117 if (ret != H_PAGE_REGISTERED || !vpage) 116 if (h_ret != H_PAGE_REGISTERED || !vpage)
118 goto create_eq_exit2; 117 goto create_eq_exit2;
119 } 118 }
120 } 119 }