linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] RDMA: simplify if-if to if-else
@ 2022-03-28 13:08 Guo Zhengkui
  2022-03-30 11:02 ` Leon Romanovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Guo Zhengkui @ 2022-03-28 13:08 UTC (permalink / raw)
  To: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Yishai Hadas,
	open list:INTEL ETHERNET PROTOCOL DRIVER FOR RDMA, open list
  Cc: zhengkui_guo, Guo Zhengkui

`if (!ret)` can be replaced with `else` for simplification.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/infiniband/hw/irdma/puda.c | 4 ++--
 drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
index 397f3d070f90..ee91424eb94a 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -842,7 +842,7 @@ static void irdma_puda_free_qp(struct irdma_puda_rsrc *rsrc)
 		ibdev_dbg(to_ibdev(dev),
 			  "PUDA: error puda qp destroy wqe, status = %d\n",
 			  ret);
-	if (!ret) {
+	else {
 		ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_QP,
 						    &compl_info);
 		if (ret)
@@ -871,7 +871,7 @@ static void irdma_puda_free_cq(struct irdma_puda_rsrc *rsrc)
 	ret = irdma_sc_cq_destroy(&rsrc->cq, 0, true);
 	if (ret)
 		ibdev_dbg(to_ibdev(dev), "PUDA: error ieq cq destroy\n");
-	if (!ret) {
+	else {
 		ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_CQ,
 						    &compl_info);
 		if (ret)
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index 33f525b744f2..a8c8d432d0dc 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -304,9 +304,8 @@ static int send_leave_to_wire(struct mcast_group *group, u8 join_state)
 	ret = send_mad_to_wire(group->demux, (struct ib_mad *)&mad);
 	if (ret)
 		group->state = MCAST_IDLE;
-
 	/* set timeout handler */
-	if (!ret) {
+	else {
 		/* calls mlx4_ib_mcg_timeout_handler */
 		queue_delayed_work(group->demux->mcg_wq, &group->timeout_work,
 				msecs_to_jiffies(MAD_TIMEOUT_MS));
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-28 13:08 [PATCH linux-next] RDMA: simplify if-if to if-else Guo Zhengkui
@ 2022-03-30 11:02 ` Leon Romanovsky
  2022-03-30 11:06   ` Haakon Bugge
  0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-30 11:02 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Yishai Hadas,
	open list:INTEL ETHERNET PROTOCOL DRIVER FOR RDMA, open list,
	zhengkui_guo

On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
> `if (!ret)` can be replaced with `else` for simplification.
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  drivers/infiniband/hw/irdma/puda.c | 4 ++--
>  drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-30 11:02 ` Leon Romanovsky
@ 2022-03-30 11:06   ` Haakon Bugge
  2022-03-30 11:32     ` Leon Romanovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Haakon Bugge @ 2022-03-30 11:06 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Yishai Hadas,
	OFED mailing list, open list, zhengkui_guo, Leon Romanovsky



> On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
> 
> On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
>> `if (!ret)` can be replaced with `else` for simplification.
>> 
>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
>> ---
>> drivers/infiniband/hw/irdma/puda.c | 4 ++--
>> drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
>> 2 files changed, 3 insertions(+), 4 deletions(-)
>> 
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

Fix the unbalanced curly brackets at the same time?


Thxs, Håkon



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-30 11:06   ` Haakon Bugge
@ 2022-03-30 11:32     ` Leon Romanovsky
  2022-03-30 12:26       ` Haakon Bugge
  0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-30 11:32 UTC (permalink / raw)
  To: Haakon Bugge
  Cc: Guo Zhengkui, Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe,
	Yishai Hadas, OFED mailing list, open list, zhengkui_guo

On Wed, Mar 30, 2022 at 11:06:03AM +0000, Haakon Bugge wrote:
> 
> 
> > On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
> > 
> > On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
> >> `if (!ret)` can be replaced with `else` for simplification.
> >> 
> >> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> >> ---
> >> drivers/infiniband/hw/irdma/puda.c | 4 ++--
> >> drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
> >> 2 files changed, 3 insertions(+), 4 deletions(-)
> >> 
> > 
> > Thanks,
> > Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> 
> Fix the unbalanced curly brackets at the same time?

I think that it is ok to have if () ... else { ... } code.

There is one place that needs an indentation fix, in mlx4, but it is
faster to fix when applying the patch instead of asking to resubmit.

thanks

> 
> 
> Thxs, Håkon
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-30 11:32     ` Leon Romanovsky
@ 2022-03-30 12:26       ` Haakon Bugge
  2022-03-30 12:56         ` Leon Romanovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Haakon Bugge @ 2022-03-30 12:26 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Guo Zhengkui, Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe,
	Yishai Hadas, OFED mailing list, open list, zhengkui_guo



> On 30 Mar 2022, at 13:32, Leon Romanovsky <leon@kernel.org> wrote:
> 
> On Wed, Mar 30, 2022 at 11:06:03AM +0000, Haakon Bugge wrote:
>> 
>> 
>>> On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
>>> 
>>> On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
>>>> `if (!ret)` can be replaced with `else` for simplification.
>>>> 
>>>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
>>>> ---
>>>> drivers/infiniband/hw/irdma/puda.c | 4 ++--
>>>> drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
>>>> 2 files changed, 3 insertions(+), 4 deletions(-)
>>>> 
>>> 
>>> Thanks,
>>> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
>> 
>> Fix the unbalanced curly brackets at the same time?
> 
> I think that it is ok to have if () ... else { ... } code.


Hmm, doesn't the kernel coding style say:

"Do not unnecessarily use braces where a single statement will do."

[snip]

"This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches"


Thxs, Håkon


> 
> There is one place that needs an indentation fix, in mlx4, but it is
> faster to fix when applying the patch instead of asking to resubmit.
> 
> thanks
> 
>> 
>> 
>> Thxs, Håkon


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-30 12:26       ` Haakon Bugge
@ 2022-03-30 12:56         ` Leon Romanovsky
  2022-03-31  3:03           ` Guo Zhengkui
  0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-30 12:56 UTC (permalink / raw)
  To: Haakon Bugge
  Cc: Guo Zhengkui, Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe,
	Yishai Hadas, OFED mailing list, open list, zhengkui_guo

On Wed, Mar 30, 2022 at 12:26:51PM +0000, Haakon Bugge wrote:
> 
> 
> > On 30 Mar 2022, at 13:32, Leon Romanovsky <leon@kernel.org> wrote:
> > 
> > On Wed, Mar 30, 2022 at 11:06:03AM +0000, Haakon Bugge wrote:
> >> 
> >> 
> >>> On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
> >>> 
> >>> On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
> >>>> `if (!ret)` can be replaced with `else` for simplification.
> >>>> 
> >>>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> >>>> ---
> >>>> drivers/infiniband/hw/irdma/puda.c | 4 ++--
> >>>> drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
> >>>> 2 files changed, 3 insertions(+), 4 deletions(-)
> >>>> 
> >>> 
> >>> Thanks,
> >>> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> >> 
> >> Fix the unbalanced curly brackets at the same time?
> > 
> > I think that it is ok to have if () ... else { ... } code.
> 
> 
> Hmm, doesn't the kernel coding style say:
> 
> "Do not unnecessarily use braces where a single statement will do."
> 
> [snip]
> 
> "This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches"

ok, if it is written in documentation, let's follow it.

Thanks for pointing that out.

> 
> 
> Thxs, Håkon
> 
> 
> > 
> > There is one place that needs an indentation fix, in mlx4, but it is
> > faster to fix when applying the patch instead of asking to resubmit.
> > 
> > thanks
> > 
> >> 
> >> 
> >> Thxs, Håkon
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-30 12:56         ` Leon Romanovsky
@ 2022-03-31  3:03           ` Guo Zhengkui
  2022-03-31  9:05             ` Leon Romanovsky
  0 siblings, 1 reply; 11+ messages in thread
From: Guo Zhengkui @ 2022-03-31  3:03 UTC (permalink / raw)
  To: Leon Romanovsky, Haakon Bugge
  Cc: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Yishai Hadas,
	OFED mailing list, open list, zhengkui_guo

On 2022/3/30 20:56, Leon Romanovsky wrote:
> On Wed, Mar 30, 2022 at 12:26:51PM +0000, Haakon Bugge wrote:
>>
>>
>>> On 30 Mar 2022, at 13:32, Leon Romanovsky <leon@kernel.org> wrote:
>>>
>>> On Wed, Mar 30, 2022 at 11:06:03AM +0000, Haakon Bugge wrote:
>>>>
>>>>
>>>>> On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
>>>>>
>>>>> On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
>>>>>> `if (!ret)` can be replaced with `else` for simplification.
>>>>>>
>>>>>> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
>>>>>> ---
>>>>>> drivers/infiniband/hw/irdma/puda.c | 4 ++--
>>>>>> drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
>>>>>> 2 files changed, 3 insertions(+), 4 deletions(-)
>>>>>>
>>>>>
>>>>> Thanks,
>>>>> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
>>>>
>>>> Fix the unbalanced curly brackets at the same time?
>>>
>>> I think that it is ok to have if () ... else { ... } code.
>>
>>
>> Hmm, doesn't the kernel coding style say:
>>
>> "Do not unnecessarily use braces where a single statement will do."
>>
>> [snip]
>>
>> "This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches"
> 
> ok, if it is written in documentation, let's follow it.
> 
> Thanks for pointing that out.

Should I resubmit the patch including unbalanced curly brackets fixing? 
If not, I can submit another patch to fix this problem.

> 
>>
>>
>> Thxs, Håkon
>>
>>
>>>
>>> There is one place that needs an indentation fix, in mlx4, but it is
>>> faster to fix when applying the patch instead of asking to resubmit.
>>>
>>> thanks
>>>
>>>>
>>>>
>>>> Thxs, Håkon
>>

Thanks,

Zhengkui

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next] RDMA: simplify if-if to if-else
  2022-03-31  3:03           ` Guo Zhengkui
@ 2022-03-31  9:05             ` Leon Romanovsky
  2022-03-31 13:05               ` [PATCH linux-next v2] " Guo Zhengkui
  0 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2022-03-31  9:05 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Haakon Bugge, Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe,
	Yishai Hadas, OFED mailing list, open list, zhengkui_guo

On Thu, Mar 31, 2022 at 11:03:30AM +0800, Guo Zhengkui wrote:
> On 2022/3/30 20:56, Leon Romanovsky wrote:
> > On Wed, Mar 30, 2022 at 12:26:51PM +0000, Haakon Bugge wrote:
> > > 
> > > 
> > > > On 30 Mar 2022, at 13:32, Leon Romanovsky <leon@kernel.org> wrote:
> > > > 
> > > > On Wed, Mar 30, 2022 at 11:06:03AM +0000, Haakon Bugge wrote:
> > > > > 
> > > > > 
> > > > > > On 30 Mar 2022, at 13:02, Leon Romanovsky <leon@kernel.org> wrote:
> > > > > > 
> > > > > > On Mon, Mar 28, 2022 at 09:08:59PM +0800, Guo Zhengkui wrote:
> > > > > > > `if (!ret)` can be replaced with `else` for simplification.
> > > > > > > 
> > > > > > > Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> > > > > > > ---
> > > > > > > drivers/infiniband/hw/irdma/puda.c | 4 ++--
> > > > > > > drivers/infiniband/hw/mlx4/mcg.c   | 3 +--
> > > > > > > 2 files changed, 3 insertions(+), 4 deletions(-)
> > > > > > > 
> > > > > > 
> > > > > > Thanks,
> > > > > > Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> > > > > 
> > > > > Fix the unbalanced curly brackets at the same time?
> > > > 
> > > > I think that it is ok to have if () ... else { ... } code.
> > > 
> > > 
> > > Hmm, doesn't the kernel coding style say:
> > > 
> > > "Do not unnecessarily use braces where a single statement will do."
> > > 
> > > [snip]
> > > 
> > > "This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches"
> > 
> > ok, if it is written in documentation, let's follow it.
> > 
> > Thanks for pointing that out.
> 
> Should I resubmit the patch including unbalanced curly brackets fixing? If
> not, I can submit another patch to fix this problem.

Your patch wasn't merged yet, so new version should be sent.

Thanks 
> 
> > 
> > > 
> > > 
> > > Thxs, Håkon
> > > 
> > > 
> > > > 
> > > > There is one place that needs an indentation fix, in mlx4, but it is
> > > > faster to fix when applying the patch instead of asking to resubmit.
> > > > 
> > > > thanks
> > > > 
> > > > > 
> > > > > 
> > > > > Thxs, Håkon
> > > 
> 
> Thanks,
> 
> Zhengkui

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH linux-next v2] RDMA: simplify if-if to if-else
  2022-03-31  9:05             ` Leon Romanovsky
@ 2022-03-31 13:05               ` Guo Zhengkui
  2022-03-31 13:58                 ` Saleem, Shiraz
  2022-04-04 13:56                 ` Jason Gunthorpe
  0 siblings, 2 replies; 11+ messages in thread
From: Guo Zhengkui @ 2022-03-31 13:05 UTC (permalink / raw)
  To: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Yishai Hadas,
	open list:INTEL ETHERNET PROTOCOL DRIVER FOR RDMA, open list
  Cc: zhengkui_guo, Guo Zhengkui

Replace `if (!ret)` with `else` for simplification and
fix the unbalanced curly brackets.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/infiniband/hw/irdma/puda.c |  8 ++++----
 drivers/infiniband/hw/mlx4/mcg.c   | 29 +++++++++++++++++------------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/infiniband/hw/irdma/puda.c b/drivers/infiniband/hw/irdma/puda.c
index 397f3d070f90..8dd38e1f6cf0 100644
--- a/drivers/infiniband/hw/irdma/puda.c
+++ b/drivers/infiniband/hw/irdma/puda.c
@@ -838,11 +838,11 @@ static void irdma_puda_free_qp(struct irdma_puda_rsrc *rsrc)
 	}
 
 	ret = irdma_sc_qp_destroy(&rsrc->qp, 0, false, true, true);
-	if (ret)
+	if (ret) {
 		ibdev_dbg(to_ibdev(dev),
 			  "PUDA: error puda qp destroy wqe, status = %d\n",
 			  ret);
-	if (!ret) {
+	} else {
 		ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_QP,
 						    &compl_info);
 		if (ret)
@@ -869,9 +869,9 @@ static void irdma_puda_free_cq(struct irdma_puda_rsrc *rsrc)
 	}
 
 	ret = irdma_sc_cq_destroy(&rsrc->cq, 0, true);
-	if (ret)
+	if (ret) {
 		ibdev_dbg(to_ibdev(dev), "PUDA: error ieq cq destroy\n");
-	if (!ret) {
+	} else {
 		ret = irdma_sc_poll_for_cqp_op_done(dev->cqp, IRDMA_CQP_OP_DESTROY_CQ,
 						    &compl_info);
 		if (ret)
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index 33f525b744f2..c0beb9f4030a 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -304,13 +304,11 @@ static int send_leave_to_wire(struct mcast_group *group, u8 join_state)
 	ret = send_mad_to_wire(group->demux, (struct ib_mad *)&mad);
 	if (ret)
 		group->state = MCAST_IDLE;
-
 	/* set timeout handler */
-	if (!ret) {
+	else
 		/* calls mlx4_ib_mcg_timeout_handler */
 		queue_delayed_work(group->demux->mcg_wq, &group->timeout_work,
 				msecs_to_jiffies(MAD_TIMEOUT_MS));
-	}
 
 	return ret;
 }
@@ -561,8 +559,9 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
 				return;
 			}
 			mutex_lock(&group->lock);
-		} else
+		} else {
 			mcg_warn_group(group, "DRIVER BUG\n");
+		}
 	} else if (group->state == MCAST_LEAVE_SENT) {
 		if (group->rec.scope_join_state & 0xf)
 			group->rec.scope_join_state &= 0xf0;
@@ -571,8 +570,9 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
 		if (release_group(group, 1))
 			return;
 		mutex_lock(&group->lock);
-	} else
+	} else {
 		mcg_warn_group(group, "invalid state %s\n", get_state_string(group->state));
+	}
 	group->state = MCAST_IDLE;
 	atomic_inc(&group->refcount);
 	if (!queue_work(group->demux->mcg_wq, &group->work))
@@ -632,7 +632,7 @@ static int handle_join_req(struct mcast_group *group, u8 join_mask,
 			kfree(req);
 			ref = 1;
 			group->state = group->prev_state;
-		} else
+		} else {
 			group->state = MCAST_JOIN_SENT;
 	}
 
@@ -681,10 +681,12 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
 						list_del(&req->func_list);
 						kfree(req);
 						++rc;
-					} else
+					} else {
 						mcg_warn_group(group, "no request for failed join\n");
-			} else if (method == IB_SA_METHOD_DELETE_RESP && group->demux->flushing)
+					}
+			} else if (method == IB_SA_METHOD_DELETE_RESP && group->demux->flushing) {
 				++rc;
+			}
 		} else {
 			u8 resp_join_state;
 			u8 cur_join_state;
@@ -697,8 +699,9 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
 				/* successfull join */
 				if (!cur_join_state && resp_join_state)
 					--rc;
-			} else if (!resp_join_state)
-					++rc;
+			} else if (!resp_join_state) {
+				++rc;
+			}
 			memcpy(&group->rec, group->response_sa_mad.data, sizeof group->rec);
 		}
 		group->state = MCAST_IDLE;
@@ -730,8 +733,9 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
 			if (send_leave_to_wire(group, req_join_state)) {
 				group->state = group->prev_state;
 				++rc;
-			} else
+			} else {
 				group->state = MCAST_LEAVE_SENT;
+			}
 		}
 	}
 
@@ -898,8 +902,9 @@ int mlx4_ib_mcg_demux_handler(struct ib_device *ibdev, int port, int slave,
 				__be64 tid = mad->mad_hdr.tid;
 				*(u8 *)(&tid) = (u8)slave; /* in group we kept the modified TID */
 				group = search_relocate_mgid0_group(ctx, tid, &rec->mgid);
-			} else
+			} else {
 				group = NULL;
+			}
 		}
 
 		if (!group)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [PATCH linux-next v2] RDMA: simplify if-if to if-else
  2022-03-31 13:05               ` [PATCH linux-next v2] " Guo Zhengkui
@ 2022-03-31 13:58                 ` Saleem, Shiraz
  2022-04-04 13:56                 ` Jason Gunthorpe
  1 sibling, 0 replies; 11+ messages in thread
From: Saleem, Shiraz @ 2022-03-31 13:58 UTC (permalink / raw)
  To: Guo Zhengkui, Ismail, Mustafa, Jason Gunthorpe, Yishai Hadas,
	open list:INTEL ETHERNET PROTOCOL DRIVER FOR RDMA, open list
  Cc: zhengkui_guo

> Subject: [PATCH linux-next v2] RDMA: simplify if-if to if-else
> 
> Replace `if (!ret)` with `else` for simplification and fix the unbalanced curly
> brackets.
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  drivers/infiniband/hw/irdma/puda.c |  8 ++++----

Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH linux-next v2] RDMA: simplify if-if to if-else
  2022-03-31 13:05               ` [PATCH linux-next v2] " Guo Zhengkui
  2022-03-31 13:58                 ` Saleem, Shiraz
@ 2022-04-04 13:56                 ` Jason Gunthorpe
  1 sibling, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2022-04-04 13:56 UTC (permalink / raw)
  To: Guo Zhengkui
  Cc: Mustafa Ismail, Shiraz Saleem, Yishai Hadas,
	open list:INTEL ETHERNET PROTOCOL DRIVER FOR RDMA, open list,
	zhengkui_guo

On Thu, Mar 31, 2022 at 09:05:25PM +0800, Guo Zhengkui wrote:
> @@ -632,7 +632,7 @@ static int handle_join_req(struct mcast_group *group, u8 join_mask,
>  			kfree(req);
>  			ref = 1;
>  			group->state = group->prev_state;
> -		} else
> +		} else {
>  			group->state = MCAST_JOIN_SENT;
>  	}

This doesn't compile.

Jason

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-04-04 13:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 13:08 [PATCH linux-next] RDMA: simplify if-if to if-else Guo Zhengkui
2022-03-30 11:02 ` Leon Romanovsky
2022-03-30 11:06   ` Haakon Bugge
2022-03-30 11:32     ` Leon Romanovsky
2022-03-30 12:26       ` Haakon Bugge
2022-03-30 12:56         ` Leon Romanovsky
2022-03-31  3:03           ` Guo Zhengkui
2022-03-31  9:05             ` Leon Romanovsky
2022-03-31 13:05               ` [PATCH linux-next v2] " Guo Zhengkui
2022-03-31 13:58                 ` Saleem, Shiraz
2022-04-04 13:56                 ` Jason Gunthorpe

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).