diff mbox

bnx2i: silence uninitialized variable warnings

Message ID 20160414094006.GB16891@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter April 14, 2016, 9:40 a.m. UTC
Presumably it isn't possible to have empty lists here, but my static
checker doesn't know that and complains that "ep" can be used
uninitialized.

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

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Nilesh Javali April 18, 2016, 5:17 a.m. UTC | #1
On 14/04/16 3:10 PM, "Dan Carpenter" <dan.carpenter@oracle.com> wrote:

>Presumably it isn't possible to have empty lists here, but my static
>checker doesn't know that and complains that "ep" can be used
>uninitialized.
>
>Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c
>b/drivers/scsi/bnx2i/bnx2i_iscsi.c
>index 7289437..133901f 100644
>--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
>+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
>@@ -675,7 +675,7 @@ bnx2i_find_ep_in_ofld_list(struct bnx2i_hba *hba, u32
>iscsi_cid)
> {
> 	struct list_head *list;
> 	struct list_head *tmp;
>-	struct bnx2i_endpoint *ep;
>+	struct bnx2i_endpoint *ep = NULL;
> 
> 	read_lock_bh(&hba->ep_rdwr_lock);
> 	list_for_each_safe(list, tmp, &hba->ep_ofld_list) {
>@@ -703,7 +703,7 @@ bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba,
>u32 iscsi_cid)
> {
> 	struct list_head *list;
> 	struct list_head *tmp;
>-	struct bnx2i_endpoint *ep;
>+	struct bnx2i_endpoint *ep = NULL;
> 
> 	read_lock_bh(&hba->ep_rdwr_lock);
> 	list_for_each_safe(list, tmp, &hba->ep_destroy_list) {

Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen April 26, 2016, 2:03 a.m. UTC | #2
>>>>> "Dan" == Dan Carpenter <dan.carpenter@oracle.com> writes:

Dan> Presumably it isn't possible to have empty lists here, but my
Dan> static checker doesn't know that and complains that "ep" can be
Dan> used uninitialized.

Applied to 4.7/scsi-queue.
diff mbox

Patch

diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 7289437..133901f 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -675,7 +675,7 @@  bnx2i_find_ep_in_ofld_list(struct bnx2i_hba *hba, u32 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
 	list_for_each_safe(list, tmp, &hba->ep_ofld_list) {
@@ -703,7 +703,7 @@  bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
 	list_for_each_safe(list, tmp, &hba->ep_destroy_list) {