diff mbox

i40iw: silence an uninitialized variable warning

Message ID 20170118103452.GA12778@mwanda (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Carpenter Jan. 18, 2017, 10:34 a.m. UTC
These can be used without being uninitialized but it's only a printk()
so it's not the end of the world.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Comments

Yuval Shaia Jan. 18, 2017, 11:19 a.m. UTC | #1
On Wed, Jan 18, 2017 at 01:34:53PM +0300, Dan Carpenter wrote:
> These can be used without being uninitialized but it's only a printk()
> so it's not the end of the world.

In an ideal world i would expect cqp_create function to set maj_err and
min_err when replying with error return code.

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
> index 2728af3..7b78a17 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_main.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
> @@ -561,7 +561,7 @@ static enum i40iw_status_code i40iw_create_cqp(struct i40iw_device *iwdev)
>  	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
>  	struct i40iw_cqp_init_info cqp_init_info;
>  	struct i40iw_cqp *cqp = &iwdev->cqp;
> -	u16 maj_err, min_err;
> +	u16 maj_err = 0, min_err = 0;
>  	int i;
>  
>  	cqp->cqp_requests = kcalloc(sqsize, sizeof(*cqp->cqp_requests), GFP_KERNEL);
> --
> 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
--
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
Doug Ledford Jan. 24, 2017, 9:24 p.m. UTC | #2
On Wed, 2017-01-18 at 13:34 +0300, Dan Carpenter wrote:
> These can be used without being uninitialized but it's only a
> printk()
> so it's not the end of the world.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c
> b/drivers/infiniband/hw/i40iw/i40iw_main.c
> index 2728af3..7b78a17 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_main.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
> @@ -561,7 +561,7 @@ static enum i40iw_status_code
> i40iw_create_cqp(struct i40iw_device *iwdev)
>  	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
>  	struct i40iw_cqp_init_info cqp_init_info;
>  	struct i40iw_cqp *cqp = &iwdev->cqp;
> -	u16 maj_err, min_err;
> +	u16 maj_err = 0, min_err = 0;
>  	int i;
>  
>  	cqp->cqp_requests = kcalloc(sqsize, sizeof(*cqp-
> >cqp_requests), GFP_KERNEL);

Thanks for the patch, but I dropped this in in lieu of the patch to
make cqp_create always set both error codes.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index 2728af3..7b78a17 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -561,7 +561,7 @@  static enum i40iw_status_code i40iw_create_cqp(struct i40iw_device *iwdev)
 	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
 	struct i40iw_cqp_init_info cqp_init_info;
 	struct i40iw_cqp *cqp = &iwdev->cqp;
-	u16 maj_err, min_err;
+	u16 maj_err = 0, min_err = 0;
 	int i;
 
 	cqp->cqp_requests = kcalloc(sqsize, sizeof(*cqp->cqp_requests), GFP_KERNEL);