Skip to contentSkip to conversation

i40iw: silence an uninitialized variable warning

PATCH In review Dan Carpenter 3 participants 3 messages Jan 18, 2017 – Jan 24, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40iw: silence an uninitialized variable warning

These can be used without being uninitialized but it's only a printk() so it's not the end of the world.

drivers/infiniband/hw/i40iw/i40iw_main.c +1 -1
index 2728af3..7b78a17 100644
@@ -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);
#1 lore raw
Quoted 2 lines · Dan Carpenter

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.

Quoted 20 lines
drivers/infiniband/hw/i40iw/i40iw_main.c +1 -2
index 2728af3..7b78a17 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Dan Carpenter
Quoted 19 lines · Dan Carpenter

These can be used without being uninitialized but it's only a printk()
so it's not the end of the world.

drivers/infiniband/hw/i40iw/i40iw_main.c +1 -1
index 2728af3..7b78a17 100644
@@ -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;
Quoted 3 lines


  cqp->cqp_requests = kcalloc(sqsize, sizeof(*cqp-

Quoted 1 line

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.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD