aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 56c01938f714..42eaed88c281 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1202,6 +1202,7 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
1202 struct ipath_ah *ah; 1202 struct ipath_ah *ah;
1203 struct ib_ah *ret; 1203 struct ib_ah *ret;
1204 struct ipath_ibdev *dev = to_idev(pd->device); 1204 struct ipath_ibdev *dev = to_idev(pd->device);
1205 unsigned long flags;
1205 1206
1206 /* A multicast address requires a GRH (see ch. 8.4.1). */ 1207 /* A multicast address requires a GRH (see ch. 8.4.1). */
1207 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE && 1208 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
@@ -1228,16 +1229,16 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
1228 goto bail; 1229 goto bail;
1229 } 1230 }
1230 1231
1231 spin_lock(&dev->n_ahs_lock); 1232 spin_lock_irqsave(&dev->n_ahs_lock, flags);
1232 if (dev->n_ahs_allocated == ib_ipath_max_ahs) { 1233 if (dev->n_ahs_allocated == ib_ipath_max_ahs) {
1233 spin_unlock(&dev->n_ahs_lock); 1234 spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
1234 kfree(ah); 1235 kfree(ah);
1235 ret = ERR_PTR(-ENOMEM); 1236 ret = ERR_PTR(-ENOMEM);
1236 goto bail; 1237 goto bail;
1237 } 1238 }
1238 1239
1239 dev->n_ahs_allocated++; 1240 dev->n_ahs_allocated++;
1240 spin_unlock(&dev->n_ahs_lock); 1241 spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
1241 1242
1242 /* ib_create_ah() will initialize ah->ibah. */ 1243 /* ib_create_ah() will initialize ah->ibah. */
1243 ah->attr = *ah_attr; 1244 ah->attr = *ah_attr;
@@ -1258,10 +1259,11 @@ static int ipath_destroy_ah(struct ib_ah *ibah)
1258{ 1259{
1259 struct ipath_ibdev *dev = to_idev(ibah->device); 1260 struct ipath_ibdev *dev = to_idev(ibah->device);
1260 struct ipath_ah *ah = to_iah(ibah); 1261 struct ipath_ah *ah = to_iah(ibah);
1262 unsigned long flags;
1261 1263
1262 spin_lock(&dev->n_ahs_lock); 1264 spin_lock_irqsave(&dev->n_ahs_lock, flags);
1263 dev->n_ahs_allocated--; 1265 dev->n_ahs_allocated--;
1264 spin_unlock(&dev->n_ahs_lock); 1266 spin_unlock_irqrestore(&dev->n_ahs_lock, flags);
1265 1267
1266 kfree(ah); 1268 kfree(ah);
1267 1269