diff mbox series

[v2,1/2] IB/qib: remove superfluous fallthrough statements

Message ID 20200825171242.448447-1-alex.dewar90@gmail.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [v2,1/2] IB/qib: remove superfluous fallthrough statements | expand

Commit Message

Alex Dewar Aug. 25, 2020, 5:12 p.m. UTC
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(-)

Comments

Gustavo A. R. Silva Aug. 25, 2020, 7:33 p.m. UTC | #1
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
>
Gustavo A. R. Silva Aug. 26, 2020, 7:18 p.m. UTC | #2
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
Jason Gunthorpe Aug. 27, 2020, 12:11 a.m. UTC | #3
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
Gustavo A. R. Silva Aug. 27, 2020, 1:41 a.m. UTC | #4
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
Alex Dewar Aug. 27, 2020, 10:40 a.m. UTC | #5
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
Jason Gunthorpe Aug. 31, 2020, 4:25 p.m. UTC | #6
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
diff mbox series

Patch

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