Skip to contentSkip to conversation

scsi: fix integer as NULL pointer warnings

PATCH Applied Harvey Harrison 4 participants 6 messages Apr 30, 2008 – May 1, 2008

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

PATCH 2/10 scsi: fix integer as NULL pointer warnings

drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:3585:60: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:3845:56: warning: Using plain integer as NULL pointer drivers/scsi/qla1280.c:2814:37: warning: Using plain integer as NULL pointer drivers/scsi/atp870u.c:750:47: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1281:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1293:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1301:35: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:447:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:457:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:479:24: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:483:22: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1213:23: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1214:23: warning: Using plain integer as NULL pointer

---
James, please look at the FlashPoint.c changes in particular.

 drivers/scsi/3w-9xxx.c    |    6 +++---
 drivers/scsi/FlashPoint.c |    7 +++----
 drivers/scsi/aha152x.c    |    4 ++--
 drivers/scsi/atp870u.c    |    2 +-
 drivers/scsi/hptiop.c     |   12 ++++++------
 drivers/scsi/qla1280.c    |    2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)
drivers/scsi/3w-9xxx.c +3 -3
index b31faec..626d6e1 100644
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 			error = 0;
 			/* Check for command packet errors */
 			if (full_command_packet->command.newcommand.status != 0) {
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					error = twa_fill_sense(tw_dev, request_id, 1, 1);
 				} else {
 					/* Skip ioctl error prints */
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 
 			/* Check for correct state */
 			if (tw_dev->state[request_id] != TW_S_POSTED) {
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted");
 					TW_CLEAR_ALL_INTERRUPTS(tw_dev);
 					goto twa_interrupt_bail;
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 			}
 
 			/* Check for internal command completion */
-			if (tw_dev->srb[request_id] == 0) {
+			if (tw_dev->srb[request_id]) {
 				if (request_id != tw_dev->chrdev_request_id) {
 					if (twa_aen_complete(tw_dev, request_id))
 						TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt");
drivers/scsi/FlashPoint.c +3 -4
index b898d38..b252ac5 100644
@@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
 static void FPT_autoLoadDefaultMap(unsigned long p_port);
 
 static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
+    { {{NULL}} };
+static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
 static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
 static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
 
@@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
 
 static unsigned short FPT_default_intena = 0;
 
-static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
-0};
+static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {NULL};
 
 /*---------------------------------------------------------------------
  *
drivers/scsi/aha152x.c +2 -2
index f5215fd..0c93a49 100644
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup)
 	if (i == ARRAY_SIZE(ports))
 		return 0;
 
-	if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
+	if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
 		printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
 		return 0;
 	}
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void)
 			if ((setup_count == 1) && (setup[0].io_port == ports[i]))
 				continue;
 
-			if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) {
+			if (!request_region(ports[i], IO_RANGE, "aha152x")) {
 				printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
 				continue;
 			}
drivers/scsi/atp870u.c +1 -1
index db6de5e..571b43b 100644
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
 		dev->quhd[c] = 0;
 	}
 	workreq = dev->quereq[c][dev->quhd[c]];
-	if (dev->id[c][scmd_id(workreq)].curr_req == 0) {	
+	if (!dev->id[c][scmd_id(workreq)].curr_req) {	
 		dev->id[c][scmd_id(workreq)].curr_req = workreq;
 		dev->last_cmd[c] = scmd_id(workreq);
 		goto cmd_subp;
drivers/scsi/hptiop.c +6 -6
index 5b7be1e..bc5fb5c 100644
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
 	if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) {
 		printk(KERN_ERR "scsi%d: pci resource invalid\n",
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 
 	mem_base_phy = pci_resource_start(pcidev, index);
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
 	if (!mem_base_virt) {
 		printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n",
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 	return mem_base_virt;
 }
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba)
 static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba)
 {
 	hba->u.mv.regs = hptiop_map_pci_bar(hba, 0);
-	if (hba->u.mv.regs == 0)
+	if (!hba->u.mv.regs)
 		return -1;
 
 	hba->u.mv.mu = hptiop_map_pci_bar(hba, 2);
-	if (hba->u.mv.mu == 0) {
+	if (!hba->u.mv.mu) {
 		iounmap(hba->u.mv.regs);
 		return -1;
 	}
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev)
 
 static struct hptiop_adapter_ops hptiop_itl_ops = {
 	.iop_wait_ready    = iop_wait_ready_itl,
-	.internal_memalloc = 0,
-	.internal_memfree  = 0,
+	.internal_memalloc = NULL,
+	.internal_memfree  = NULL,
 	.map_pci_bar       = hptiop_map_pci_bar_itl,
 	.unmap_pci_bar     = hptiop_unmap_pci_bar_itl,
 	.enable_intr       = hptiop_enable_intr_itl,
drivers/scsi/qla1280.c +1 -1
index 09ab3ea..d2bc60a 100644
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
 
 	/* Check for room in outstanding command list. */
 	for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS &&
-		     ha->outstanding_cmds[cnt] != 0; cnt++);
+		     ha->outstanding_cmds[cnt] != NULL; cnt++);
 
 	if (cnt >= MAX_OUTSTANDING_COMMANDS) {
 		status = 1;
Signature · 1 line
1.5.5.1.305.g7c84
maintainer
#1 lore raw
Quoted 17 lines · Harvey Harrison

drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:3585:60: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:3845:56: warning: Using plain integer as NULL pointer drivers/scsi/qla1280.c:2814:37: warning: Using plain integer as NULL pointer drivers/scsi/atp870u.c:750:47: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1281:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1293:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1301:35: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:447:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:457:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:479:24: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:483:22: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1213:23: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1214:23: warning: Using plain integer as NULL pointer

Quoted 3 lines

---
James, please look at the FlashPoint.c changes in particular.

Could you please Cc linux-scsi? That way interested parties get to check their drivers.

The flashpoint initialiser changes look wrong: {0} is a conventional notation for zero initialise this structure. Sparse should probably be taught to recognise that.

James

Quoted 159 lines
 drivers/scsi/3w-9xxx.c    |    6 +++---
 drivers/scsi/FlashPoint.c |    7 +++----
 drivers/scsi/aha152x.c    |    4 ++--
 drivers/scsi/atp870u.c    |    2 +-
 drivers/scsi/hptiop.c     |   12 ++++++------
 drivers/scsi/qla1280.c    |    2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)
drivers/scsi/3w-9xxx.c +3 -3
index b31faec..626d6e1 100644
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 			error = 0;
 			/* Check for command packet errors */
 			if (full_command_packet->command.newcommand.status != 0) {
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					error = twa_fill_sense(tw_dev, request_id, 1, 1);
 				} else {
 					/* Skip ioctl error prints */
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 
 			/* Check for correct state */
 			if (tw_dev->state[request_id] != TW_S_POSTED) {
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted");
 					TW_CLEAR_ALL_INTERRUPTS(tw_dev);
 					goto twa_interrupt_bail;
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 			}
 
 			/* Check for internal command completion */
-			if (tw_dev->srb[request_id] == 0) {
+			if (tw_dev->srb[request_id]) {
 				if (request_id != tw_dev->chrdev_request_id) {
 					if (twa_aen_complete(tw_dev, request_id))
 						TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt");
drivers/scsi/FlashPoint.c +3 -4
index b898d38..b252ac5 100644
@@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
 static void FPT_autoLoadDefaultMap(unsigned long p_port);
 
 static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
+    { {{NULL}} };
+static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
 static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
 static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
 
@@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
 
 static unsigned short FPT_default_intena = 0;
 
-static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
-0};
+static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {NULL};
 
 /*---------------------------------------------------------------------
  *
drivers/scsi/aha152x.c +2 -2
index f5215fd..0c93a49 100644
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup)
 	if (i == ARRAY_SIZE(ports))
 		return 0;
 
-	if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
+	if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
 		printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port);
 		return 0;
 	}
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void)
 			if ((setup_count == 1) && (setup[0].io_port == ports[i]))
 				continue;
 
-			if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) {
+			if (!request_region(ports[i], IO_RANGE, "aha152x")) {
 				printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]);
 				continue;
 			}
drivers/scsi/atp870u.c +1 -1
index db6de5e..571b43b 100644
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)
 		dev->quhd[c] = 0;
 	}
 	workreq = dev->quereq[c][dev->quhd[c]];
-	if (dev->id[c][scmd_id(workreq)].curr_req == 0) {	
+	if (!dev->id[c][scmd_id(workreq)].curr_req) {	
 		dev->id[c][scmd_id(workreq)].curr_req = workreq;
 		dev->last_cmd[c] = scmd_id(workreq);
 		goto cmd_subp;
drivers/scsi/hptiop.c +6 -6
index 5b7be1e..bc5fb5c 100644
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
 	if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) {
 		printk(KERN_ERR "scsi%d: pci resource invalid\n",
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 
 	mem_base_phy = pci_resource_start(pcidev, index);
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index)
 	if (!mem_base_virt) {
 		printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n",
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 	return mem_base_virt;
 }
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba)
 static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba)
 {
 	hba->u.mv.regs = hptiop_map_pci_bar(hba, 0);
-	if (hba->u.mv.regs == 0)
+	if (!hba->u.mv.regs)
 		return -1;
 
 	hba->u.mv.mu = hptiop_map_pci_bar(hba, 2);
-	if (hba->u.mv.mu == 0) {
+	if (!hba->u.mv.mu) {
 		iounmap(hba->u.mv.regs);
 		return -1;
 	}
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev)
 
 static struct hptiop_adapter_ops hptiop_itl_ops = {
 	.iop_wait_ready    = iop_wait_ready_itl,
-	.internal_memalloc = 0,
-	.internal_memfree  = 0,
+	.internal_memalloc = NULL,
+	.internal_memfree  = NULL,
 	.map_pci_bar       = hptiop_map_pci_bar_itl,
 	.unmap_pci_bar     = hptiop_unmap_pci_bar_itl,
 	.enable_intr       = hptiop_enable_intr_itl,
drivers/scsi/qla1280.c +1 -1
index 09ab3ea..d2bc60a 100644
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
 
 	/* Check for room in outstanding command list. */
 	for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS &&
-		     ha->outstanding_cmds[cnt] != 0; cnt++);
+		     ha->outstanding_cmds[cnt] != NULL; cnt++);
 
 	if (cnt >= MAX_OUTSTANDING_COMMANDS) {
 		status = 1;
#2 lore raw
Quoted 8 lines · James Bottomley
Quoted 3 lines · Harvey Harrison

drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer

The flashpoint initialiser changes look wrong: {0} is a conventional notation for zero initialise this structure. Sparse should probably be taught to recognise that.

Actually, looking closer, should this be initialized at all? Can we just remove the initialization here and let them end up in .bss?

Harvey

maintainer
#3 lore raw
Quoted 6 lines · Harvey Harrison
Quoted 4 lines · James Bottomley
Quoted 3 lines · Harvey Harrison

drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL pointer drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL pointer

Quoted 6 lines
Quoted 3 lines

The flashpoint initialiser changes look wrong: {0} is a conventional notation for zero initialise this structure. Sparse should probably be taught to recognise that.

Actually, looking closer, should this be initialized at all? Can we just remove the initialization here and let them end up in .bss?

Yes, but the conventional initialiser doesn't change that (as in zero initialise a static and it ends up in bss anyway).

James

#4 lore raw
In reply to James Bottomley

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of James Bottomley
Sent: Thursday, May 01, 2008 8:29 AM
To: Harvey Harrison
Cc: Andrew Morton; LKML; linux-scsi
Subject: Re: [PATCH 02/10] scsi: fix integer as NULL pointer warnings

Quoted 1 line · Harvey Harrison

drivers/scsi/FlashPoint.c:906:9: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/FlashPoint.c:907:53: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/FlashPoint.c:922:1: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/aha152x.c:3585:60: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/aha152x.c:3845:56: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/qla1280.c:2814:37: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/atp870u.c:750:47: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/3w-9xxx.c:1281:36: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/3w-9xxx.c:1293:36: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/3w-9xxx.c:1301:35: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:447:10: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:457:10: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:479:24: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:483:22: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:1213:23: warning: Using plain integer as NULL

pointer

Quoted 1 line

drivers/scsi/hptiop.c:1214:23: warning: Using plain integer as NULL

pointer

Quoted 4 lines

---
James, please look at the FlashPoint.c changes in particular.

Could you please Cc linux-scsi? That way interested parties get to check their drivers.

The flashpoint initialiser changes look wrong: {0} is a conventional notation for zero initialise this structure. Sparse should probably be taught to recognise that.

James

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void

Quoted 13 lines
 drivers/scsi/3w-9xxx.c    |    6 +++---
 drivers/scsi/FlashPoint.c |    7 +++----
 drivers/scsi/aha152x.c    |    4 ++--
 drivers/scsi/atp870u.c    |    2 +-
 drivers/scsi/hptiop.c     |   12 ++++++------
 drivers/scsi/qla1280.c    |    2 +-
 6 files changed, 16 insertions(+), 17 deletions(-)
drivers/scsi/3w-9xxx.c +0 -0
index b31faec..626d6e1 100644
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void

*dev_instance)

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void *dev_instance)

Quoted 3 lines
drivers/scsi/3w-9xxx.c +0 -0
 			error = 0;
 			/* Check for command packet errors */
 			if

(full_command_packet->command.newcommand.status != 0) {

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void *dev_instance)

Quoted 3 lines
drivers/scsi/3w-9xxx.c +1 -1
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					error = twa_fill_sense(tw_dev,

request_id, 1, 1);

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void

Quoted 3 lines
drivers/scsi/3w-9xxx.c +0 -0
 				} else {
 					/* Skip ioctl error prints */
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void

*dev_instance)

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void *dev_instance)

Quoted 6 lines
drivers/scsi/3w-9xxx.c +1 -1
 			/* Check for correct state */
 			if (tw_dev->state[request_id] != TW_S_POSTED) {
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {
 					TW_PRINTK(tw_dev->host,

TW_DRIVER, 0x1a, "Received a request id that wasn't posted");

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void

Quoted 3 lines
drivers/scsi/3w-9xxx.c +0 -0
 					TW_CLEAR_ALL_INTERRUPTS(tw_dev);
 					goto twa_interrupt_bail;
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void

*dev_instance)

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void *dev_instance) · line 1301

Quoted 5 lines
drivers/scsi/3w-9xxx.c +1 -1
 			}
 
 			/* Check for internal command completion */
-			if (tw_dev->srb[request_id] == 0) {
+			if (tw_dev->srb[request_id]) {

Swapped the test from zero to non-zero ?

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void · line 1302

Quoted 1 line
drivers/scsi/3w-9xxx.c +0 -0
 				if (request_id !=

tw_dev->chrdev_request_id) {

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void · line 1303

Quoted 1 line
drivers/scsi/3w-9xxx.c +0 -0
 					if (twa_aen_complete(tw_dev,

request_id))

drivers/scsi/3w-9xxx.c static irqreturn_t twa_interrupt(int irq, void · line 1304

Quoted 1 line
drivers/scsi/3w-9xxx.c +0 -0
 						TW_PRINTK(tw_dev->host,

TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt");

drivers/scsi/FlashPoint.c static void FPT_autoCmdCmplt(unsigned long p_port,

Quoted 5 lines
drivers/scsi/FlashPoint.c +0 -0
index b898d38..b252ac5 100644
@@ -903,8 +903,8 @@ static void FPT_autoCmdCmplt(unsigned long p_port,

unsigned char p_card);

drivers/scsi/FlashPoint.c static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);

Quoted 3 lines
drivers/scsi/FlashPoint.c +0 -0
 static void FPT_autoLoadDefaultMap(unsigned long p_port);
 
 static struct sccb_mgr_tar_info

FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =

Quoted 8 lines
drivers/scsi/FlashPoint.c +2 -2
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
+    { {{NULL}} };
+static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {NULL} };
 static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
 static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
 

drivers/scsi/FlashPoint.c static unsigned char FPT_scamHAString[] = · line 921

Quoted 6 lines
drivers/scsi/FlashPoint.c +1 -2
@@ -918,8 +918,7 @@ static unsigned char FPT_scamHAString[] =
 
 static unsigned short FPT_default_intena = 0;
 
-static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = {
-0};
+static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) =

{NULL};

Quoted 2 lines

/*---------------------------------------------------------------------

drivers/scsi/aha152x.c static int checksetup(struct aha152x_setup

Quoted 6 lines

*

drivers/scsi/aha152x.c +0 -0
index f5215fd..0c93a49 100644
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup

*setup)

drivers/scsi/aha152x.c static int checksetup(struct aha152x_setup *setup)

Quoted 6 lines
drivers/scsi/aha152x.c +1 -1
 	if (i == ARRAY_SIZE(ports))
 		return 0;
 
-	if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) {
+	if (!request_region(setup->io_port, IO_RANGE, "aha152x")) {
 		printk(KERN_ERR "aha152x: io port 0x%x busy.\n",

setup->io_port);

drivers/scsi/aha152x.c static int __init aha152x_init(void) · line 3842

Quoted 4 lines
drivers/scsi/aha152x.c +0 -0
 		return 0;
 	}
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void)
 			if ((setup_count == 1) && (setup[0].io_port ==

ports[i]))

drivers/scsi/aha152x.c static int __init aha152x_init(void)

Quoted 3 lines
drivers/scsi/aha152x.c +0 -1
 				continue;
 
-			if ( request_region(ports[i], IO_RANGE,

"aha152x")==0 ) {

drivers/scsi/aha152x.c static int __init aha152x_init(void) · line 3845

Quoted 1 line
drivers/scsi/aha152x.c +1 -0
+			if (!request_region(ports[i], IO_RANGE,

"aha152x")) {

drivers/scsi/aha152x.c static int __init aha152x_init(void) · line 3846

Quoted 1 line
drivers/scsi/aha152x.c +0 -0
 				printk(KERN_ERR "aha152x: io port 0x%x

busy.\n", ports[i]);

drivers/scsi/atp870u.c static void send_s870(struct atp_unit

Quoted 7 lines
drivers/scsi/aha152x.c +0 -0
 				continue;
 			}
drivers/scsi/atp870u.c +0 -0
index db6de5e..571b43b 100644
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit

*dev,unsigned char c)

drivers/scsi/hptiop.c static void __iomem *hptiop_map_pci_bar(struct

Quoted 13 lines
drivers/scsi/atp870u.c +1 -1
 		dev->quhd[c] = 0;
 	}
 	workreq = dev->quereq[c][dev->quhd[c]];
-	if (dev->id[c][scmd_id(workreq)].curr_req == 0) {	
+	if (!dev->id[c][scmd_id(workreq)].curr_req) {	
 		dev->id[c][scmd_id(workreq)].curr_req = workreq;
 		dev->last_cmd[c] = scmd_id(workreq);
 		goto cmd_subp;
drivers/scsi/hptiop.c +0 -0
index 5b7be1e..bc5fb5c 100644
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct

hptiop_hba *hba, int index)

drivers/scsi/hptiop.c static void __iomem *hptiop_map_pci_bar(struct

Quoted 9 lines
drivers/scsi/hptiop.c +1 -1
 	if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) {
 		printk(KERN_ERR "scsi%d: pci resource invalid\n",
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 
 	mem_base_phy = pci_resource_start(pcidev, index);
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct

hptiop_hba *hba, int index)

drivers/scsi/hptiop.c static void __iomem *hptiop_map_pci_bar(struct · line 455

Quoted 2 lines
drivers/scsi/hptiop.c +0 -0
 	if (!mem_base_virt) {
 		printk(KERN_ERR "scsi%d: Fail to ioremap memory

space\n",

drivers/scsi/hptiop.c static void hptiop_unmap_pci_bar_itl(struct

Quoted 7 lines
drivers/scsi/hptiop.c +1 -1
 				hba->host->host_no);
-		return 0;
+		return NULL;
 	}
 	return mem_base_virt;
 }
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct

hptiop_hba *hba)

drivers/scsi/hptiop.c static void hptiop_remove(struct pci_dev

Quoted 14 lines
drivers/scsi/hptiop.c +2 -2
 static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba)
 {
 	hba->u.mv.regs = hptiop_map_pci_bar(hba, 0);
-	if (hba->u.mv.regs == 0)
+	if (!hba->u.mv.regs)
 		return -1;
 
 	hba->u.mv.mu = hptiop_map_pci_bar(hba, 2);
-	if (hba->u.mv.mu == 0) {
+	if (!hba->u.mv.mu) {
 		iounmap(hba->u.mv.regs);
 		return -1;
 	}
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev

*pcidev)

drivers/scsi/qla1280.c qla1280_64bit_start_scsi(struct scsi_qla_host

Quoted 15 lines
drivers/scsi/hptiop.c +2 -2
 static struct hptiop_adapter_ops hptiop_itl_ops = {
 	.iop_wait_ready    = iop_wait_ready_itl,
-	.internal_memalloc = 0,
-	.internal_memfree  = 0,
+	.internal_memalloc = NULL,
+	.internal_memfree  = NULL,
 	.map_pci_bar       = hptiop_map_pci_bar_itl,
 	.unmap_pci_bar     = hptiop_unmap_pci_bar_itl,
 	.enable_intr       = hptiop_enable_intr_itl,
drivers/scsi/qla1280.c +0 -0
index 09ab3ea..d2bc60a 100644
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host

*ha, struct srb * sp)

drivers/scsi/qla1280.c qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) · line 2817

Quoted 8 lines
drivers/scsi/qla1280.c +1 -1
 	/* Check for room in outstanding command list. */
 	for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS &&
-		     ha->outstanding_cmds[cnt] != 0; cnt++);
+		     ha->outstanding_cmds[cnt] != NULL; cnt++);
 
 	if (cnt >= MAX_OUTSTANDING_COMMANDS) {
 		status = 1;

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

#5 lore raw
In reply to Harvey Harrison

Review

Quoted 2 lines
(quoted diff) +1 -1
-				if (tw_dev->srb[request_id] != 0) {
+				if (tw_dev->srb[request_id]) {

For pointers we should use == NULL or != NULL.

Removing the comparison removes the warning but it doesn't replace it with any useful typechecking as can be doing with NULL set as (void *)0.

This is thus a backward step.

Alan