diff mbox

[1/2] IB/mlx4: Make function use_tunnel_data return void

Message ID 1469607893-10657-2-git-send-email-yuval.shaia@oracle.com (mailing list archive)
State Accepted
Headers show

Commit Message

Yuval Shaia July 27, 2016, 8:24 a.m. UTC
No need to return int if function always returns 0

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/mlx4/cq.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

Comments

kernel test robot July 27, 2016, 8:52 a.m. UTC | #1
Hi,

[auto build test WARNING on rdma/master]
[also build test WARNING on v4.7 next-20160726]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yuval-Shaia/IB-mlx4-Make-function-use_tunnel_data-return-void/20160727-162724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: x86_64-randconfig-x014-201630 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/infiniband/hw/mlx4/cq.c: In function 'mlx4_ib_poll_one':
>> drivers/infiniband/hw/mlx4/cq.c:851:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
       if ((*cur_qp)->mlx4_ib_qp_type &
       ^~
   drivers/infiniband/hw/mlx4/cq.c:856:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
        return 0;
        ^~~~~~

vim +/if +851 drivers/infiniband/hw/mlx4/cq.c

95d04f07 Roland Dreier    2008-07-23  835  			break;
225c7b1f Roland Dreier    2007-05-08  836  		case MLX4_RECV_OPCODE_SEND:
225c7b1f Roland Dreier    2007-05-08  837  			wc->opcode   = IB_WC_RECV;
225c7b1f Roland Dreier    2007-05-08  838  			wc->wc_flags = 0;
225c7b1f Roland Dreier    2007-05-08  839  			break;
225c7b1f Roland Dreier    2007-05-08  840  		case MLX4_RECV_OPCODE_SEND_IMM:
225c7b1f Roland Dreier    2007-05-08  841  			wc->opcode	= IB_WC_RECV;
225c7b1f Roland Dreier    2007-05-08  842  			wc->wc_flags	= IB_WC_WITH_IMM;
00f7ec36 Steve Wise       2008-07-14  843  			wc->ex.imm_data = cqe->immed_rss_invalid;
225c7b1f Roland Dreier    2007-05-08  844  			break;
225c7b1f Roland Dreier    2007-05-08  845  		}
225c7b1f Roland Dreier    2007-05-08  846  
5ea8bbfc Jack Morgenstein 2014-03-12  847  		is_eth = (rdma_port_get_link_layer(wc->qp->device,
5ea8bbfc Jack Morgenstein 2014-03-12  848  						  (*cur_qp)->port) ==
5ea8bbfc Jack Morgenstein 2014-03-12  849  			  IB_LINK_LAYER_ETHERNET);
1ffeb2eb Jack Morgenstein 2012-08-03  850  		if (mlx4_is_mfunc(to_mdev(cq->ibcq.device)->dev)) {
1ffeb2eb Jack Morgenstein 2012-08-03 @851  			if ((*cur_qp)->mlx4_ib_qp_type &
1ffeb2eb Jack Morgenstein 2012-08-03  852  			    (MLX4_IB_QPT_PROXY_SMI_OWNER |
1ffeb2eb Jack Morgenstein 2012-08-03  853  			     MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI))
3404b0d4 Yuval Shaia      2016-07-27  854  				use_tunnel_data(*cur_qp, cq, wc, tail, cqe,
3404b0d4 Yuval Shaia      2016-07-27  855  						is_eth);
3404b0d4 Yuval Shaia      2016-07-27  856  				return 0;
1ffeb2eb Jack Morgenstein 2012-08-03  857  		}
1ffeb2eb Jack Morgenstein 2012-08-03  858  
225c7b1f Roland Dreier    2007-05-08  859  		wc->slid	   = be16_to_cpu(cqe->rlid);

:::::: The code at line 851 was first introduced by commit
:::::: 1ffeb2eb8be9936e9dc1f9af2d5f4c14d69a0d36 IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support

:::::: TO: Jack Morgenstein <jackm@dev.mellanox.co.il>
:::::: CC: Roland Dreier <roland@purestorage.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Leon Romanovsky July 27, 2016, 11:39 a.m. UTC | #2
On Wed, Jul 27, 2016 at 01:24:52AM -0700, Yuval Shaia wrote:
> No need to return int if function always returns 0
> 
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  drivers/infiniband/hw/mlx4/cq.c |   11 +++++------
>  1 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
> index 9f8b516..4c2e1b0 100644
> --- a/drivers/infiniband/hw/mlx4/cq.c
> +++ b/drivers/infiniband/hw/mlx4/cq.c
> @@ -576,8 +576,8 @@ static int mlx4_ib_ipoib_csum_ok(__be16 status, __be16 checksum)
>  		checksum == cpu_to_be16(0xffff);
>  }
>  
> -static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc,
> -			   unsigned tail, struct mlx4_cqe *cqe, int is_eth)
> +static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc,
> +			    unsigned tail, struct mlx4_cqe *cqe, int is_eth)
>  {
>  	struct mlx4_ib_proxy_sqp_hdr *hdr;
>  
> @@ -600,8 +600,6 @@ static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct
>  		wc->slid        = be16_to_cpu(hdr->tun.slid_mac_47_32);
>  		wc->sl          = (u8) (be16_to_cpu(hdr->tun.sl_vid) >> 12);
>  	}
> -
> -	return 0;
>  }
>  
>  static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries,
> @@ -853,8 +851,9 @@ repoll:
>  			if ((*cur_qp)->mlx4_ib_qp_type &
>  			    (MLX4_IB_QPT_PROXY_SMI_OWNER |
>  			     MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI))
> -				return use_tunnel_data(*cur_qp, cq, wc, tail,
> -						       cqe, is_eth);
> +				use_tunnel_data(*cur_qp, cq, wc, tail, cqe,
> +						is_eth);
> +				return 0;

Yeah, kbuild spotted excellent point.
It should be guarded by {}

return X -> { X; return 0; }

>  		}
>  
>  		wc->slid	   = be16_to_cpu(cqe->rlid);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot July 27, 2016, 12:53 p.m. UTC | #3
Hi,

[auto build test WARNING on rdma/master]
[also build test WARNING on v4.7 next-20160727]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yuval-Shaia/IB-mlx4-Make-function-use_tunnel_data-return-void/20160727-162724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: x86_64-randconfig-n0-07271932 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mlx4/cq.h:36,
                    from drivers/infiniband/hw/mlx4/cq.c:34:
   drivers/infiniband/hw/mlx4/cq.c: In function 'mlx4_ib_poll_one':
   include/linux/compiler.h:151:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
     ^
   include/linux/compiler.h:149:23: note: in expansion of macro '__trace_if'
    #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
                          ^~~~~~~~~~
>> drivers/infiniband/hw/mlx4/cq.c:851:4: note: in expansion of macro 'if'
       if ((*cur_qp)->mlx4_ib_qp_type &
       ^~
   drivers/infiniband/hw/mlx4/cq.c:856:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
        return 0;
        ^~~~~~

vim +/if +851 drivers/infiniband/hw/mlx4/cq.c

95d04f07 Roland Dreier    2008-07-23  835  			break;
225c7b1f Roland Dreier    2007-05-08  836  		case MLX4_RECV_OPCODE_SEND:
225c7b1f Roland Dreier    2007-05-08  837  			wc->opcode   = IB_WC_RECV;
225c7b1f Roland Dreier    2007-05-08  838  			wc->wc_flags = 0;
225c7b1f Roland Dreier    2007-05-08  839  			break;
225c7b1f Roland Dreier    2007-05-08  840  		case MLX4_RECV_OPCODE_SEND_IMM:
225c7b1f Roland Dreier    2007-05-08  841  			wc->opcode	= IB_WC_RECV;
225c7b1f Roland Dreier    2007-05-08  842  			wc->wc_flags	= IB_WC_WITH_IMM;
00f7ec36 Steve Wise       2008-07-14  843  			wc->ex.imm_data = cqe->immed_rss_invalid;
225c7b1f Roland Dreier    2007-05-08  844  			break;
225c7b1f Roland Dreier    2007-05-08  845  		}
225c7b1f Roland Dreier    2007-05-08  846  
5ea8bbfc Jack Morgenstein 2014-03-12  847  		is_eth = (rdma_port_get_link_layer(wc->qp->device,
5ea8bbfc Jack Morgenstein 2014-03-12  848  						  (*cur_qp)->port) ==
5ea8bbfc Jack Morgenstein 2014-03-12  849  			  IB_LINK_LAYER_ETHERNET);
1ffeb2eb Jack Morgenstein 2012-08-03  850  		if (mlx4_is_mfunc(to_mdev(cq->ibcq.device)->dev)) {
1ffeb2eb Jack Morgenstein 2012-08-03 @851  			if ((*cur_qp)->mlx4_ib_qp_type &
1ffeb2eb Jack Morgenstein 2012-08-03  852  			    (MLX4_IB_QPT_PROXY_SMI_OWNER |
1ffeb2eb Jack Morgenstein 2012-08-03  853  			     MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI))
3404b0d4 Yuval Shaia      2016-07-27  854  				use_tunnel_data(*cur_qp, cq, wc, tail, cqe,
3404b0d4 Yuval Shaia      2016-07-27  855  						is_eth);
3404b0d4 Yuval Shaia      2016-07-27  856  				return 0;
1ffeb2eb Jack Morgenstein 2012-08-03  857  		}
1ffeb2eb Jack Morgenstein 2012-08-03  858  
225c7b1f Roland Dreier    2007-05-08  859  		wc->slid	   = be16_to_cpu(cqe->rlid);

:::::: The code at line 851 was first introduced by commit
:::::: 1ffeb2eb8be9936e9dc1f9af2d5f4c14d69a0d36 IB/mlx4: SR-IOV IB context objects and proxy/tunnel SQP support

:::::: TO: Jack Morgenstein <jackm@dev.mellanox.co.il>
:::::: CC: Roland Dreier <roland@purestorage.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 9f8b516..4c2e1b0 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -576,8 +576,8 @@  static int mlx4_ib_ipoib_csum_ok(__be16 status, __be16 checksum)
 		checksum == cpu_to_be16(0xffff);
 }
 
-static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc,
-			   unsigned tail, struct mlx4_cqe *cqe, int is_eth)
+static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct ib_wc *wc,
+			    unsigned tail, struct mlx4_cqe *cqe, int is_eth)
 {
 	struct mlx4_ib_proxy_sqp_hdr *hdr;
 
@@ -600,8 +600,6 @@  static int use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct
 		wc->slid        = be16_to_cpu(hdr->tun.slid_mac_47_32);
 		wc->sl          = (u8) (be16_to_cpu(hdr->tun.sl_vid) >> 12);
 	}
-
-	return 0;
 }
 
 static void mlx4_ib_qp_sw_comp(struct mlx4_ib_qp *qp, int num_entries,
@@ -853,8 +851,9 @@  repoll:
 			if ((*cur_qp)->mlx4_ib_qp_type &
 			    (MLX4_IB_QPT_PROXY_SMI_OWNER |
 			     MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI))
-				return use_tunnel_data(*cur_qp, cq, wc, tail,
-						       cqe, is_eth);
+				use_tunnel_data(*cur_qp, cq, wc, tail, cqe,
+						is_eth);
+				return 0;
 		}
 
 		wc->slid	   = be16_to_cpu(cqe->rlid);