linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/qib: remove superfluous fallthrough statements
@ 2020-08-25 15:51 Alex Dewar
  2020-08-25 16:19 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 16+ messages in thread
From: Alex Dewar @ 2020-08-25 15:51 UTC (permalink / raw)
  Cc: Alex Dewar, Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel

Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
were later converted to fallthrough statements by commit df561f6688fe
("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
warning about unreachable code.

Remove the fallthrough statements and replace the mass of gotos with
simple return statements to make the code terser and less bug-prone.

Addresses-Coverity: ("Unreachable code")
Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/infiniband/hw/qib/qib_mad.c | 52 ++++++++---------------------
 1 file changed, 13 insertions(+), 39 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index e7789e724f56..f83e331977f8 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -2293,76 +2293,50 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
 			struct ib_mad *out_mad)
 {
 	struct ib_cc_mad *ccp = (struct ib_cc_mad *)out_mad;
-	int ret;
-
 	*out_mad = *in_mad;
 
 	if (ccp->class_version != 2) {
 		ccp->status |= IB_SMP_UNSUP_VERSION;
-		ret = reply((struct ib_smp *)ccp);
-		goto bail;
+		return reply((struct ib_smp *)ccp);
 	}
 
 	switch (ccp->method) {
 	case IB_MGMT_METHOD_GET:
 		switch (ccp->attr_id) {
 		case IB_CC_ATTR_CLASSPORTINFO:
-			ret = cc_get_classportinfo(ccp, ibdev);
-			goto bail;
-
+			return cc_get_classportinfo(ccp, ibdev);
 		case IB_CC_ATTR_CONGESTION_INFO:
-			ret = cc_get_congestion_info(ccp, ibdev, port);
-			goto bail;
-
+			return cc_get_congestion_info(ccp, ibdev, port);
 		case IB_CC_ATTR_CA_CONGESTION_SETTING:
-			ret = cc_get_congestion_setting(ccp, ibdev, port);
-			goto bail;
-
+			return cc_get_congestion_setting(ccp, ibdev, port);
 		case IB_CC_ATTR_CONGESTION_CONTROL_TABLE:
-			ret = cc_get_congestion_control_table(ccp, ibdev, port);
-			goto bail;
-
-			fallthrough;
+			return cc_get_congestion_control_table(ccp, ibdev, port);
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
-			ret = reply((struct ib_smp *) ccp);
-			goto bail;
+			return reply((struct ib_smp *) ccp);
 		}
-
 	case IB_MGMT_METHOD_SET:
 		switch (ccp->attr_id) {
 		case IB_CC_ATTR_CA_CONGESTION_SETTING:
-			ret = cc_set_congestion_setting(ccp, ibdev, port);
-			goto bail;
-
+			return cc_set_congestion_setting(ccp, ibdev, port);
 		case IB_CC_ATTR_CONGESTION_CONTROL_TABLE:
-			ret = cc_set_congestion_control_table(ccp, ibdev, port);
-			goto bail;
-
-			fallthrough;
+			return cc_set_congestion_control_table(ccp, ibdev, port);
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
-			ret = reply((struct ib_smp *) ccp);
-			goto bail;
+			return reply((struct ib_smp *) ccp);
 		}
-
 	case IB_MGMT_METHOD_GET_RESP:
 		/*
 		 * The ib_mad module will call us to process responses
 		 * before checking for other consumers.
 		 * Just tell the caller to process it normally.
 		 */
-		ret = IB_MAD_RESULT_SUCCESS;
-		goto bail;
-
-	case IB_MGMT_METHOD_TRAP:
-	default:
-		ccp->status |= IB_SMP_UNSUP_METHOD;
-		ret = reply((struct ib_smp *) ccp);
+		return IB_MAD_RESULT_SUCCESS;
 	}
 
-bail:
-	return ret;
+	/* method is unsupported */
+	ccp->status |= IB_SMP_UNSUP_METHOD;
+	return reply((struct ib_smp *) ccp);
 }
 
 /**
-- 
2.28.0


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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 15:51 [PATCH] IB/qib: remove superfluous fallthrough statements Alex Dewar
@ 2020-08-25 16:19 ` Gustavo A. R. Silva
  2020-08-25 16:26   ` Joe Perches
  0 siblings, 1 reply; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-25 16:19 UTC (permalink / raw)
  To: Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel



On 8/25/20 10:51, Alex Dewar wrote:
> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> were later converted to fallthrough statements by commit df561f6688fe
> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> warning about unreachable code.
> 
> Remove the fallthrough statements and replace the mass of gotos with
> simple return statements to make the code terser and less bug-prone.
> 

This should be split up into two separate patches: one to address the
fallthrough markings, and another one for the gotos.

Thanks
--
Gustavo


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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:19 ` Gustavo A. R. Silva
@ 2020-08-25 16:26   ` Joe Perches
  2020-08-25 16:49     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 16+ messages in thread
From: Joe Perches @ 2020-08-25 16:26 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel

On Tue, 2020-08-25 at 11:19 -0500, Gustavo A. R. Silva wrote:
> 
> On 8/25/20 10:51, Alex Dewar wrote:
> > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > were later converted to fallthrough statements by commit df561f6688fe
> > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > warning about unreachable code.
> > 
> > Remove the fallthrough statements and replace the mass of gotos with
> > simple return statements to make the code terser and less bug-prone.
> > 
> 
> This should be split up into two separate patches: one to address the
> fallthrough markings, and another one for the gotos.

I don't think it's necessary to break this into multiple patches.
Logical changes in a single patch are just fine, micro patches
aren't that useful.



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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:49     ` Gustavo A. R. Silva
@ 2020-08-25 16:47       ` Joe Perches
  2020-08-25 17:01         ` Gustavo A. R. Silva
  2020-08-25 16:58       ` Alex Dewar
  1 sibling, 1 reply; 16+ messages in thread
From: Joe Perches @ 2020-08-25 16:47 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel

On Tue, 2020-08-25 at 11:49 -0500, Gustavo A. R. Silva wrote:
> 
> On 8/25/20 11:26, Joe Perches wrote:
> > On Tue, 2020-08-25 at 11:19 -0500, Gustavo A. R. Silva wrote:
> > > On 8/25/20 10:51, Alex Dewar wrote:
> > > > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > > > were later converted to fallthrough statements by commit df561f6688fe
> > > > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > > > warning about unreachable code.
> > > > 
> > > > Remove the fallthrough statements and replace the mass of gotos with
> > > > simple return statements to make the code terser and less bug-prone.
> > > > 
> > > 
> > > This should be split up into two separate patches: one to address the
> > > fallthrough markings, and another one for the gotos.
> > 
> > I don't think it's necessary to break this into multiple patches.
> > Logical changes in a single patch are just fine, micro patches
> > aren't that useful.
> > 
> 
> There is a reason for this. Read the changelog text and review the patch.

What makes you think I didn't already do that?

I think your desire for micropatches is unnecessary.



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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:26   ` Joe Perches
@ 2020-08-25 16:49     ` Gustavo A. R. Silva
  2020-08-25 16:47       ` Joe Perches
  2020-08-25 16:58       ` Alex Dewar
  0 siblings, 2 replies; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-25 16:49 UTC (permalink / raw)
  To: Joe Perches, Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel



On 8/25/20 11:26, Joe Perches wrote:
> On Tue, 2020-08-25 at 11:19 -0500, Gustavo A. R. Silva wrote:
>>
>> On 8/25/20 10:51, Alex Dewar wrote:
>>> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
>>> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
>>> were later converted to fallthrough statements by commit df561f6688fe
>>> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
>>> warning about unreachable code.
>>>
>>> Remove the fallthrough statements and replace the mass of gotos with
>>> simple return statements to make the code terser and less bug-prone.
>>>
>>
>> This should be split up into two separate patches: one to address the
>> fallthrough markings, and another one for the gotos.
> 
> I don't think it's necessary to break this into multiple patches.
> Logical changes in a single patch are just fine, micro patches
> aren't that useful.
> 

There is a reason for this. Read the changelog text and review the patch.

Thanks
--
Gustavo

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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:49     ` Gustavo A. R. Silva
  2020-08-25 16:47       ` Joe Perches
@ 2020-08-25 16:58       ` Alex Dewar
  2020-08-25 17:12         ` [PATCH v2 1/2] " Alex Dewar
  2020-08-25 17:12         ` [PATCH v2 2/2] IB/qib: tidy up process_cc() Alex Dewar
  1 sibling, 2 replies; 16+ messages in thread
From: Alex Dewar @ 2020-08-25 16:58 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Joe Perches
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel

On 25/08/2020 17:49, Gustavo A. R. Silva wrote:
>
> On 8/25/20 11:26, Joe Perches wrote:
>> On Tue, 2020-08-25 at 11:19 -0500, Gustavo A. R. Silva wrote:
>>> On 8/25/20 10:51, Alex Dewar wrote:
>>>> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
>>>> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
>>>> were later converted to fallthrough statements by commit df561f6688fe
>>>> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
>>>> warning about unreachable code.
>>>>
>>>> Remove the fallthrough statements and replace the mass of gotos with
>>>> simple return statements to make the code terser and less bug-prone.
>>>>
>>> This should be split up into two separate patches: one to address the
>>> fallthrough markings, and another one for the gotos.
>> I don't think it's necessary to break this into multiple patches.
>> Logical changes in a single patch are just fine, micro patches
>> aren't that useful.
>>
> There is a reason for this. Read the changelog text and review the patch.
>
> Thanks
> --
> Gustavo
I think it probably does make sense as two patches. I'll do a resend.

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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:47       ` Joe Perches
@ 2020-08-25 17:01         ` Gustavo A. R. Silva
  2020-08-25 20:55           ` Joe Perches
  0 siblings, 1 reply; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-25 17:01 UTC (permalink / raw)
  To: Joe Perches, Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel



On 8/25/20 11:47, Joe Perches wrote:
> On Tue, 2020-08-25 at 11:49 -0500, Gustavo A. R. Silva wrote:
>>
>> On 8/25/20 11:26, Joe Perches wrote:
>>> On Tue, 2020-08-25 at 11:19 -0500, Gustavo A. R. Silva wrote:
>>>> On 8/25/20 10:51, Alex Dewar wrote:
>>>>> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
>>>>> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
>>>>> were later converted to fallthrough statements by commit df561f6688fe
>>>>> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
>>>>> warning about unreachable code.
>>>>>
>>>>> Remove the fallthrough statements and replace the mass of gotos with
>>>>> simple return statements to make the code terser and less bug-prone.
>>>>>
>>>>
>>>> This should be split up into two separate patches: one to address the
>>>> fallthrough markings, and another one for the gotos.
>>>
>>> I don't think it's necessary to break this into multiple patches.
>>> Logical changes in a single patch are just fine, micro patches
>>> aren't that useful.
>>>
>>
>> There is a reason for this. Read the changelog text and review the patch.
> 
> What makes you think I didn't already do that?
> 

You would have noticed this should be two patches.

> I think your desire for micropatches is unnecessary.
> 

You might be generalizing. My 'desire' here is justified and specific.

Thanks
--
Gustavo

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

* [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-25 16:58       ` Alex Dewar
@ 2020-08-25 17:12         ` Alex Dewar
  2020-08-25 19:33           ` Gustavo A. R. Silva
  2020-08-31 16:25           ` Jason Gunthorpe
  2020-08-25 17:12         ` [PATCH v2 2/2] IB/qib: tidy up process_cc() Alex Dewar
  1 sibling, 2 replies; 16+ messages in thread
From: Alex Dewar @ 2020-08-25 17:12 UTC (permalink / raw)
  To: alex.dewar90
  Cc: dennis.dalessandro, dledford, gustavo, jgg, joe, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
were later converted to fallthrough statements by commit df561f6688fe
("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
warning about unreachable code.

Remove the fallthrough statements.

Addresses-Coverity: ("Unreachable code")
Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
v2: Do refactoring in a separate patch (Gustavo)
---
 drivers/infiniband/hw/qib/qib_mad.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index e7789e724f56..f972e559a8a7 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -2322,7 +2322,6 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
 			ret = cc_get_congestion_control_table(ccp, ibdev, port);
 			goto bail;
 
-			fallthrough;
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
 			ret = reply((struct ib_smp *) ccp);
@@ -2339,7 +2338,6 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
 			ret = cc_set_congestion_control_table(ccp, ibdev, port);
 			goto bail;
 
-			fallthrough;
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
 			ret = reply((struct ib_smp *) ccp);
-- 
2.28.0


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

* [PATCH v2 2/2] IB/qib: tidy up process_cc()
  2020-08-25 16:58       ` Alex Dewar
  2020-08-25 17:12         ` [PATCH v2 1/2] " Alex Dewar
@ 2020-08-25 17:12         ` Alex Dewar
  1 sibling, 0 replies; 16+ messages in thread
From: Alex Dewar @ 2020-08-25 17:12 UTC (permalink / raw)
  To: alex.dewar90
  Cc: dennis.dalessandro, dledford, gustavo, jgg, joe, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

This function has a lot of gotos which could be replaced by simple
returns, making the function tidier and less bug prone.

Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
---
 drivers/infiniband/hw/qib/qib_mad.c | 50 ++++++++---------------------
 1 file changed, 13 insertions(+), 37 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index f972e559a8a7..f83e331977f8 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -2293,74 +2293,50 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
 			struct ib_mad *out_mad)
 {
 	struct ib_cc_mad *ccp = (struct ib_cc_mad *)out_mad;
-	int ret;
-
 	*out_mad = *in_mad;
 
 	if (ccp->class_version != 2) {
 		ccp->status |= IB_SMP_UNSUP_VERSION;
-		ret = reply((struct ib_smp *)ccp);
-		goto bail;
+		return reply((struct ib_smp *)ccp);
 	}
 
 	switch (ccp->method) {
 	case IB_MGMT_METHOD_GET:
 		switch (ccp->attr_id) {
 		case IB_CC_ATTR_CLASSPORTINFO:
-			ret = cc_get_classportinfo(ccp, ibdev);
-			goto bail;
-
+			return cc_get_classportinfo(ccp, ibdev);
 		case IB_CC_ATTR_CONGESTION_INFO:
-			ret = cc_get_congestion_info(ccp, ibdev, port);
-			goto bail;
-
+			return cc_get_congestion_info(ccp, ibdev, port);
 		case IB_CC_ATTR_CA_CONGESTION_SETTING:
-			ret = cc_get_congestion_setting(ccp, ibdev, port);
-			goto bail;
-
+			return cc_get_congestion_setting(ccp, ibdev, port);
 		case IB_CC_ATTR_CONGESTION_CONTROL_TABLE:
-			ret = cc_get_congestion_control_table(ccp, ibdev, port);
-			goto bail;
-
+			return cc_get_congestion_control_table(ccp, ibdev, port);
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
-			ret = reply((struct ib_smp *) ccp);
-			goto bail;
+			return reply((struct ib_smp *) ccp);
 		}
-
 	case IB_MGMT_METHOD_SET:
 		switch (ccp->attr_id) {
 		case IB_CC_ATTR_CA_CONGESTION_SETTING:
-			ret = cc_set_congestion_setting(ccp, ibdev, port);
-			goto bail;
-
+			return cc_set_congestion_setting(ccp, ibdev, port);
 		case IB_CC_ATTR_CONGESTION_CONTROL_TABLE:
-			ret = cc_set_congestion_control_table(ccp, ibdev, port);
-			goto bail;
-
+			return cc_set_congestion_control_table(ccp, ibdev, port);
 		default:
 			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
-			ret = reply((struct ib_smp *) ccp);
-			goto bail;
+			return reply((struct ib_smp *) ccp);
 		}
-
 	case IB_MGMT_METHOD_GET_RESP:
 		/*
 		 * The ib_mad module will call us to process responses
 		 * before checking for other consumers.
 		 * Just tell the caller to process it normally.
 		 */
-		ret = IB_MAD_RESULT_SUCCESS;
-		goto bail;
-
-	case IB_MGMT_METHOD_TRAP:
-	default:
-		ccp->status |= IB_SMP_UNSUP_METHOD;
-		ret = reply((struct ib_smp *) ccp);
+		return IB_MAD_RESULT_SUCCESS;
 	}
 
-bail:
-	return ret;
+	/* method is unsupported */
+	ccp->status |= IB_SMP_UNSUP_METHOD;
+	return reply((struct ib_smp *) ccp);
 }
 
 /**
-- 
2.28.0


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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-25 17:12         ` [PATCH v2 1/2] " Alex Dewar
@ 2020-08-25 19:33           ` Gustavo A. R. Silva
  2020-08-26 19:18             ` Gustavo A. R. Silva
  2020-08-31 16:25           ` Jason Gunthorpe
  1 sibling, 1 reply; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-25 19:33 UTC (permalink / raw)
  To: Alex Dewar
  Cc: dennis.dalessandro, dledford, gustavo, jgg, joe, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> were later converted to fallthrough statements by commit df561f6688fe
> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> warning about unreachable code.
>

It's worth mentioning that this warning is triggered only by compilers
that don't support __attribute__((__fallthrough__)), which has been
supported since GCC 7.1.

> Remove the fallthrough statements.
> 
> Addresses-Coverity: ("Unreachable code")
> Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

> ---
> v2: Do refactoring in a separate patch (Gustavo)
> ---

 ^^^
These dashes are not needed.

Thanks
--
Gustavo

>  drivers/infiniband/hw/qib/qib_mad.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
> index e7789e724f56..f972e559a8a7 100644
> --- a/drivers/infiniband/hw/qib/qib_mad.c
> +++ b/drivers/infiniband/hw/qib/qib_mad.c
> @@ -2322,7 +2322,6 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
>  			ret = cc_get_congestion_control_table(ccp, ibdev, port);
>  			goto bail;
>  
> -			fallthrough;
>  		default:
>  			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
>  			ret = reply((struct ib_smp *) ccp);
> @@ -2339,7 +2338,6 @@ static int process_cc(struct ib_device *ibdev, int mad_flags,
>  			ret = cc_set_congestion_control_table(ccp, ibdev, port);
>  			goto bail;
>  
> -			fallthrough;
>  		default:
>  			ccp->status |= IB_SMP_UNSUP_METH_ATTR;
>  			ret = reply((struct ib_smp *) ccp);
> -- 
> 2.28.0
> 

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

* Re: [PATCH] IB/qib: remove superfluous fallthrough statements
  2020-08-25 17:01         ` Gustavo A. R. Silva
@ 2020-08-25 20:55           ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2020-08-25 20:55 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Alex Dewar
  Cc: Dennis Dalessandro, Mike Marciniszyn, Doug Ledford,
	Jason Gunthorpe, Roland Dreier, linux-rdma, linux-kernel

On Tue, 2020-08-25 at 12:01 -0500, Gustavo A. R. Silva wrote:
> On 8/25/20 11:47, Joe Perches wrote
[]
> You would have noticed this should be two patches.

That's interpretational.

> > I think your desire for micropatches is unnecessary.
> > 
> You might be generalizing. My 'desire' here is justified and specific.

And to date undescribed.



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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-25 19:33           ` Gustavo A. R. Silva
@ 2020-08-26 19:18             ` Gustavo A. R. Silva
  2020-08-27  0:11               ` Jason Gunthorpe
  0 siblings, 1 reply; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-26 19:18 UTC (permalink / raw)
  To: Alex Dewar
  Cc: dennis.dalessandro, dledford, gustavo, jgg, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

Hi,

On Tue, Aug 25, 2020 at 02:33:27PM -0500, Gustavo A. R. Silva wrote:
> On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > were later converted to fallthrough statements by commit df561f6688fe
> > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > warning about unreachable code.
> >
> 
> It's worth mentioning that this warning is triggered only by compilers
> that don't support __attribute__((__fallthrough__)), which has been
> supported since GCC 7.1.
> 
> > Remove the fallthrough statements.
> > 
> > Addresses-Coverity: ("Unreachable code")
> > Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> 
> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> 

I can take this in my tree for 5.9-rc3.

Thanks
--
Gustavo

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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-26 19:18             ` Gustavo A. R. Silva
@ 2020-08-27  0:11               ` Jason Gunthorpe
  2020-08-27  1:41                 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 16+ messages in thread
From: Jason Gunthorpe @ 2020-08-27  0:11 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Alex Dewar, dennis.dalessandro, dledford, gustavo, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

On Wed, Aug 26, 2020 at 02:18:59PM -0500, Gustavo A. R. Silva wrote:
> Hi,
> 
> On Tue, Aug 25, 2020 at 02:33:27PM -0500, Gustavo A. R. Silva wrote:
> > On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> > > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > > were later converted to fallthrough statements by commit df561f6688fe
> > > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > > warning about unreachable code.
> > >
> > 
> > It's worth mentioning that this warning is triggered only by compilers
> > that don't support __attribute__((__fallthrough__)), which has been
> > supported since GCC 7.1.
> > 
> > > Remove the fallthrough statements.
> > > 
> > > Addresses-Coverity: ("Unreachable code")
> > > Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> > 
> > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > 
> 
> I can take this in my tree for 5.9-rc3.

That would make conflicts for the 2nd patch, lets just send them all
through the rdma tree please. Is there a reason this is -rc material?

Jason

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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-27  0:11               ` Jason Gunthorpe
@ 2020-08-27  1:41                 ` Gustavo A. R. Silva
  2020-08-27 10:40                   ` Alex Dewar
  0 siblings, 1 reply; 16+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-27  1:41 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Alex Dewar, dennis.dalessandro, dledford, gustavo, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

On Wed, Aug 26, 2020 at 09:11:49PM -0300, Jason Gunthorpe wrote:
> On Wed, Aug 26, 2020 at 02:18:59PM -0500, Gustavo A. R. Silva wrote:
> > Hi,
> > 
> > On Tue, Aug 25, 2020 at 02:33:27PM -0500, Gustavo A. R. Silva wrote:
> > > On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> > > > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > > > were later converted to fallthrough statements by commit df561f6688fe
> > > > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > > > warning about unreachable code.
> > > >
> > > 
> > > It's worth mentioning that this warning is triggered only by compilers
> > > that don't support __attribute__((__fallthrough__)), which has been
> > > supported since GCC 7.1.
> > > 
> > > > Remove the fallthrough statements.
> > > > 
> > > > Addresses-Coverity: ("Unreachable code")
> > > > Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > > Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> > > 
> > > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > > 
> > 
> > I can take this in my tree for 5.9-rc3.
> 
> That would make conflicts for the 2nd patch, lets just send them all
> through the rdma tree please.

OK.

> Is there a reason this is -rc material?

It's just that this warning is currently in mainline.

Thanks
--
Gustavo

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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-27  1:41                 ` Gustavo A. R. Silva
@ 2020-08-27 10:40                   ` Alex Dewar
  0 siblings, 0 replies; 16+ messages in thread
From: Alex Dewar @ 2020-08-27 10:40 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jason Gunthorpe, Alex Dewar, dennis.dalessandro, dledford,
	gustavo, linux-kernel, linux-rdma, mike.marciniszyn, roland

On Wed, Aug 26, 2020 at 08:41:20PM -0500, Gustavo A. R. Silva wrote:
> On Wed, Aug 26, 2020 at 09:11:49PM -0300, Jason Gunthorpe wrote:
> > On Wed, Aug 26, 2020 at 02:18:59PM -0500, Gustavo A. R. Silva wrote:
> > > Hi,
> > > 
> > > On Tue, Aug 25, 2020 at 02:33:27PM -0500, Gustavo A. R. Silva wrote:
> > > > On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> > > > > Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > > > erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> > > > > were later converted to fallthrough statements by commit df561f6688fe
> > > > > ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> > > > > warning about unreachable code.
> > > > >
> > > > 
> > > > It's worth mentioning that this warning is triggered only by compilers
> > > > that don't support __attribute__((__fallthrough__)), which has been
> > > > supported since GCC 7.1.
> > > > 
> > > > > Remove the fallthrough statements.
> > > > > 
> > > > > Addresses-Coverity: ("Unreachable code")
> > > > > Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> > > > > Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> > > > 
> > > > Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > > > 
> > > 
> > > I can take this in my tree for 5.9-rc3.
> > 
> > That would make conflicts for the 2nd patch, lets just send them all
> > through the rdma tree please.
> 
> OK.
> 
> > Is there a reason this is -rc material?
> 
> It's just that this warning is currently in mainline.

FYI this issue was found with Coverity, not a compiler. I just built the
unfixed version from mainline (with gcc 10.2.0) and didn't get any
warnings.

> 
> Thanks
> --
> Gustavo

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

* Re: [PATCH v2 1/2] IB/qib: remove superfluous fallthrough statements
  2020-08-25 17:12         ` [PATCH v2 1/2] " Alex Dewar
  2020-08-25 19:33           ` Gustavo A. R. Silva
@ 2020-08-31 16:25           ` Jason Gunthorpe
  1 sibling, 0 replies; 16+ messages in thread
From: Jason Gunthorpe @ 2020-08-31 16:25 UTC (permalink / raw)
  To: Alex Dewar
  Cc: dennis.dalessandro, dledford, gustavo, joe, linux-kernel,
	linux-rdma, mike.marciniszyn, roland

On Tue, Aug 25, 2020 at 06:12:42PM +0100, Alex Dewar wrote:
> Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> erroneously marked a couple of switch cases as /* FALLTHROUGH */, which
> were later converted to fallthrough statements by commit df561f6688fe
> ("treewide: Use fallthrough pseudo-keyword"). This triggered a Coverity
> warning about unreachable code.
> 
> Remove the fallthrough statements.
> 
> Addresses-Coverity: ("Unreachable code")
> Fixes: 36a8f01cd24b ("IB/qib: Add congestion control agent implementation")
> Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> v2: Do refactoring in a separate patch (Gustavo)
> ---
>  drivers/infiniband/hw/qib/qib_mad.c | 2 --
>  1 file changed, 2 deletions(-)

Both applied to for-next, thanks

Jason

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

end of thread, other threads:[~2020-08-31 16:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 15:51 [PATCH] IB/qib: remove superfluous fallthrough statements Alex Dewar
2020-08-25 16:19 ` Gustavo A. R. Silva
2020-08-25 16:26   ` Joe Perches
2020-08-25 16:49     ` Gustavo A. R. Silva
2020-08-25 16:47       ` Joe Perches
2020-08-25 17:01         ` Gustavo A. R. Silva
2020-08-25 20:55           ` Joe Perches
2020-08-25 16:58       ` Alex Dewar
2020-08-25 17:12         ` [PATCH v2 1/2] " Alex Dewar
2020-08-25 19:33           ` Gustavo A. R. Silva
2020-08-26 19:18             ` Gustavo A. R. Silva
2020-08-27  0:11               ` Jason Gunthorpe
2020-08-27  1:41                 ` Gustavo A. R. Silva
2020-08-27 10:40                   ` Alex Dewar
2020-08-31 16:25           ` Jason Gunthorpe
2020-08-25 17:12         ` [PATCH v2 2/2] IB/qib: tidy up process_cc() Alex Dewar

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