Re: [PATCH rdma-next v1] RDMA/mlx5: Clean WQE page fault handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 14, 2019 at 12:46:05PM +0300, Dan Carpenter wrote:
> On Thu, Mar 14, 2019 at 09:14:08AM +0000, Leon Romanovsky wrote:
> > On Mon, Feb 25, 2019 at 08:56:14AM +0200, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > >
> > > Refactor the page fault handler to be more readable and extensible,
> > > this cleanup was triggered by error reported below. The code structure
> > > made unclear to the automatic tools to identify that such flow is not
> > > possible in real life because "requestor != NULL" means that "qp != NULL"
> > > too.
> > >
> > >     drivers/infiniband/hw/mlx5/odp.c:1254 mlx5_ib_mr_wqe_pfault_handler()
> > >     error: we previously assumed 'qp' could be null (see line 1230)
> > >
> > > Fixes: 08100fad5cac ("IB/mlx5: Add ODP SRQ support")
> > > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > > Reviewed-by: Moni Shoua <monis@xxxxxxxxxxxx>
> > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > > Changes v0->v1:
> > >  * Instead of simple fix, rewrote whole function to be more clear.
> > >  drivers/infiniband/hw/mlx5/odp.c | 121 ++++++++++++++-----------------
> > >  1 file changed, 55 insertions(+), 66 deletions(-)
> > >
> > > diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
> > > index c20bfc41ecf1..31caced2e8c2 100644
> > > +++ b/drivers/infiniband/hw/mlx5/odp.c
> > > @@ -919,7 +919,7 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev,
> > >  				   struct mlx5_pagefault *pfault,
> > >  				   void *wqe,
> > >  				   void *wqe_end, u32 *bytes_mapped,
> > > -				   u32 *total_wqe_bytes, int receive_queue)
> > > +				   u32 *total_wqe_bytes, bool receive_queue)
> > >  {
> > >  	int ret = 0, npages = 0;
> > >  	u64 io_virt;
> > > @@ -1199,17 +1199,15 @@ static inline struct mlx5_ib_srq *res_to_srq(struct mlx5_core_rsc_common *res)
> > >  static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
> > >  					  struct mlx5_pagefault *pfault)
> > >  {
> > > -	int ret;
> > > -	void *wqe, *wqe_end;
> > > +	bool sq = pfault->type & MLX5_PFAULT_REQUESTOR;
> > > +	u16 wqe_index = pfault->wqe.wqe_index;
> > > +	void *wqe = NULL, *wqe_end = NULL;
> > >  	u32 bytes_mapped, total_wqe_bytes;
> > > -	char *buffer = NULL;
> > > +	struct mlx5_core_rsc_common *res;
> > >  	int resume_with_error = 1;
> > > -	u16 wqe_index = pfault->wqe.wqe_index;
> > > -	int requestor = pfault->type & MLX5_PFAULT_REQUESTOR;
> > > -	struct mlx5_core_rsc_common *res = NULL;
> > > -	struct mlx5_ib_qp *qp = NULL;
> > > -	struct mlx5_ib_srq *srq = NULL;
> > > +	struct mlx5_ib_qp *qp;
> > >  	size_t bytes_copied;
> > > +	int ret;
> > 
> > It should be "int ret = 0;"
> > 
> 
> This patch makes Smatch happy btw, but it's too clever for GCC.

? gcc throws a warning with this?

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux