Re: [PATCH rdma-next 1/2] RDMA/uverbs: Remove redundant assignments

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

 



On Sun, Jul 19, 2020 at 09:03:18AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>
> The kbuild reported the following warning, so clean whole uverbs_cmd.c file.
>
>    drivers/infiniband/core/uverbs_cmd.c:1066:6: warning: Variable 'ret'
> is reassigned a value before the old one has
> been used. [redundantAssignment]
>     ret = uverbs_request(attrs, &cmd, sizeof(cmd));
>         ^
>    drivers/infiniband/core/uverbs_cmd.c:1064:0: note: Variable 'ret' is
> reassigned a value before the old one has been
> used.
>     int    ret = -EINVAL;
>    ^
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/core/uverbs_cmd.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index a66fc3e37a74..7d2b4258f573 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -558,9 +558,9 @@ static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
>  	struct ib_uverbs_open_xrcd	cmd;
>  	struct ib_uxrcd_object         *obj;
>  	struct ib_xrcd                 *xrcd = NULL;
> -	struct fd			f = {NULL, 0};
> +	struct fd f = {};
>  	struct inode                   *inode = NULL;
> -	int				ret = 0;
> +	int ret;
>  	int				new_xrcd = 0;
>  	struct ib_device *ib_dev;
>
> @@ -761,7 +761,7 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
>  {
>  	struct ib_uverbs_rereg_mr      cmd;
>  	struct ib_uverbs_rereg_mr_resp resp;
> -	struct ib_pd                *pd = NULL;
> +	struct ib_pd *pd;

This line shouldn't be changed, PD is passed as an argument to ops.rereg_user_mr.

Thanks



[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