Skip to contentSkip to conversation

fixup! RDMA/counter: Combine allocation and bind logic

PATCH In review Leon Romanovsky 2 participants 2 messages Nov 16, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixup! RDMA/counter: Combine allocation and bind logic

From: Leon Romanovsky <[email protected]>

Jason, please squash this fixup to kbuild report I got tonight, Thanks.

--------
Failure in __rdma_counter_bind_qp() will cause
to mutex_unlock(&port_counter->lock); call again.

---
 drivers/infiniband/core/counters.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/core/counters.c +4 -2
index 4e1ec4479e0b..2c67ba6a2725 100644
@@ -124,14 +124,17 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u8 port,
 	case RDMA_COUNTER_MODE_MANUAL:
 		ret = __counter_set_mode(&port_counter->mode,
 					 RDMA_COUNTER_MODE_MANUAL, 0);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&port_counter->lock);
 			goto err_mode;
+		}
 		break;
 	case RDMA_COUNTER_MODE_AUTO:
 		auto_mode_init_counter(counter, qp, port_counter->mode.mask);
 		break;
 	default:
 		ret = -EOPNOTSUPP;
+		mutex_unlock(&port_counter->lock);
 		goto err_mode;
 	}
 
@@ -151,7 +154,6 @@ static struct rdma_counter *alloc_and_bind(struct ib_device *dev, u8 port,
 	return counter;
 
 err_mode:
-	mutex_unlock(&port_counter->lock);
 	kfree(counter->stats);
 err_stats:
 	rdma_restrack_put(&counter->res);

--
2.28.0

maintainer
#1 lore raw
Quoted 4 lines · Leon Romanovsky

From: Leon Romanovsky <[email protected]>

Jason, please squash this fixup to kbuild report I got tonight, Thanks.

Quoted 8 lines

--------
Failure in __rdma_counter_bind_qp() will cause
to mutex_unlock(&port_counter->lock); call again.

---
 drivers/infiniband/core/counters.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Ok, done

Thanks,
Jason