Browse Source

[build] Fix uses of literal 0 as a NULL pointer

Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
b9663b8049

+ 1
- 1
src/drivers/net/3c515.c View File

389
 		outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold);	/* Room for a packet. */
389
 		outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold);	/* Room for a packet. */
390
 		/* Clear the Tx ring. */
390
 		/* Clear the Tx ring. */
391
 		for (i = 0; i < TX_RING_SIZE; i++)
391
 		for (i = 0; i < TX_RING_SIZE; i++)
392
-			vp->tx_skbuff[i] = 0;
392
+			vp->tx_skbuff[i] = NULL;
393
 		outl(0, nic->ioaddr + DownListPtr);
393
 		outl(0, nic->ioaddr + DownListPtr);
394
 	}
394
 	}
395
 	/* Set receiver mode: presumably accept b-case and phys addr only. */
395
 	/* Set receiver mode: presumably accept b-case and phys addr only. */

+ 2
- 2
src/drivers/net/3c595.c View File

399
 
399
 
400
     i = vx_connector;       /* default in EEPROM */
400
     i = vx_connector;       /* default in EEPROM */
401
     reason = "default";
401
     reason = "default";
402
-    warning = 0;
402
+    warning = NULL;
403
 
403
 
404
     if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
404
     if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
405
         warning = "strange connector type in EEPROM.";
405
         warning = "strange connector type in EEPROM.";
407
         i = CONNECTOR_UTP;
407
         i = CONNECTOR_UTP;
408
     }
408
     }
409
 
409
 
410
-        if (warning != 0) {
410
+        if (warning) {
411
             printf("warning: %s\n", warning);
411
             printf("warning: %s\n", warning);
412
         }
412
         }
413
         printf("selected %s. (%s)\n", conn_tab[i].name, reason);
413
         printf("selected %s. (%s)\n", conn_tab[i].name, reason);

+ 0
- 3
src/drivers/net/bnx2.c View File

2617
 	struct bnx2 *bp = &bnx2;
2617
 	struct bnx2 *bp = &bnx2;
2618
 	int i, rc;
2618
 	int i, rc;
2619
 
2619
 
2620
-	if (pdev == 0)
2621
-		return 0;
2622
-
2623
 	memset(bp, 0, sizeof(*bp));
2620
 	memset(bp, 0, sizeof(*bp));
2624
 
2621
 
2625
 	rc = bnx2_init_board(pdev, nic);
2622
 	rc = bnx2_init_board(pdev, nic);

+ 2
- 1
src/drivers/net/etherfabric.c View File

3798
 	}
3798
 	}
3799
 	else {
3799
 	else {
3800
 		/* write to the INT_ACK register */
3800
 		/* write to the INT_ACK register */
3801
-		falcon_writel ( efab, 0, FCN_INT_ACK_KER_REG_A1 );
3801
+		EFAB_ZERO_DWORD ( reg );
3802
+		falcon_writel ( efab, &reg, FCN_INT_ACK_KER_REG_A1 );
3802
 		mb();
3803
 		mb();
3803
 		falcon_readl ( efab, &reg,
3804
 		falcon_readl ( efab, &reg,
3804
 			       WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );
3805
 			       WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );

+ 1
- 1
src/drivers/net/ns8390.c View File

895
 #endif
895
 #endif
896
 			0 };
896
 			0 };
897
 		/* if no addresses supplied, fall back on defaults */
897
 		/* if no addresses supplied, fall back on defaults */
898
-		if (probe_addrs == 0 || probe_addrs[0] == 0)
898
+		if (probe_addrs == NULL || probe_addrs[0] == 0)
899
 			probe_addrs = base;
899
 			probe_addrs = base;
900
 		eth_bmem = 0;		/* No shared memory */
900
 		eth_bmem = 0;		/* No shared memory */
901
 		for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {
901
 		for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {

+ 1
- 3
src/drivers/net/prism2.c View File

130
 } hfa384x_t;
130
 } hfa384x_t;
131
 
131
 
132
 /* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */
132
 /* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */
133
-static hfa384x_t hw_global = {
134
-  0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0}
135
-};
133
+static hfa384x_t hw_global;
136
 
134
 
137
 /*
135
 /*
138
  * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)
136
  * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)

+ 1
- 1
src/drivers/net/sis900.c View File

111
 //  {"NS 83851 PHY",0x2000, 0x5C20, MIX },
111
 //  {"NS 83851 PHY",0x2000, 0x5C20, MIX },
112
     {"RTL 8201 10/100Mbps Phyceiver"   , 0x0000, 0x8200,rtl8201_read_mode},
112
     {"RTL 8201 10/100Mbps Phyceiver"   , 0x0000, 0x8200,rtl8201_read_mode},
113
     {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
113
     {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
114
-    {0,0,0,0}
114
+    {NULL,0,0,NULL}
115
 };
115
 };
116
 
116
 
117
 static struct mii_phy {
117
 static struct mii_phy {

+ 2
- 2
src/drivers/net/tlan.c View File

94
 
94
 
95
 static const char *media[] = {
95
 static const char *media[] = {
96
 	"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
96
 	"10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
97
-	"100baseTx-FD", "100baseT4", 0
97
+	"100baseTx-FD", "100baseT4", NULL
98
 };
98
 };
99
 
99
 
100
 /* This much match tlan_pci_tbl[]!  */
100
 /* This much match tlan_pci_tbl[]!  */
164
 	{"Compaq NetFlex-3/E", 0,	/* EISA card */
164
 	{"Compaq NetFlex-3/E", 0,	/* EISA card */
165
 	 {0, 0, 0, 0, 0, 0},
165
 	 {0, 0, 0, 0, 0, 0},
166
 	 TLAN_ADAPTER_ACTIVITY_LED, 0x83},
166
 	 TLAN_ADAPTER_ACTIVITY_LED, 0x83},
167
-	{0, 0,
167
+	{NULL, 0,
168
 	 {0, 0, 0, 0, 0, 0},
168
 	 {0, 0, 0, 0, 0, 0},
169
 	 0, 0},
169
 	 0, 0},
170
 };
170
 };

+ 4
- 4
src/drivers/net/tulip.c View File

228
       TULIP_IOTYPE, TULIP_SIZE, COMET },
228
       TULIP_IOTYPE, TULIP_SIZE, COMET },
229
     { "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 },
229
     { "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 },
230
       TULIP_IOTYPE, 256, COMET },	/*Ramesh Chander*/
230
       TULIP_IOTYPE, 256, COMET },	/*Ramesh Chander*/
231
-    { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 },
231
+    { NULL, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 },
232
 };
232
 };
233
 
233
 
234
 enum tbl_flag {
234
 enum tbl_flag {
264
     { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII 
264
     { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII 
265
       | HAS_PWRDWN | HAS_NWAY },
265
       | HAS_PWRDWN | HAS_NWAY },
266
     { "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY },	/*Ramesh Chander*/   
266
     { "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY },	/*Ramesh Chander*/   
267
-    { 0, 0 },
267
+    { NULL, 0 },
268
 };
268
 };
269
 
269
 
270
 /* A full-duplex map for media types. */
270
 /* A full-duplex map for media types. */
475
                                     0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
475
                                     0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
476
                                     0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */
476
                                     0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */
477
     }},
477
     }},
478
-    {0, 0, 0, 0, {}}};
478
+    {NULL, 0, 0, 0, {}}};
479
 
479
 
480
 static const char * block_name[] = {"21140 non-MII", "21140 MII PHY",
480
 static const char * block_name[] = {"21140 non-MII", "21140 MII PHY",
481
                                     "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"};
481
                                     "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"};
720
 
720
 
721
     whereami("parse_eeprom\n");
721
     whereami("parse_eeprom\n");
722
 
722
 
723
-    tp->mtable = 0;
723
+    tp->mtable = NULL;
724
     /* Detect an old-style (SA only) EEPROM layout:
724
     /* Detect an old-style (SA only) EEPROM layout:
725
        memcmp(ee_data, ee_data+16, 8). */
725
        memcmp(ee_data, ee_data+16, 8). */
726
     for (i = 0; i < 8; i ++)
726
     for (i = 0; i < 8; i ++)

+ 1
- 1
src/drivers/net/via-velocity.c View File

1230
 	u32 TxPhyAddr, RxPhyAddr;
1230
 	u32 TxPhyAddr, RxPhyAddr;
1231
 	u32 TxBufPhyAddr, RxBufPhyAddr;
1231
 	u32 TxBufPhyAddr, RxBufPhyAddr;
1232
 	vptr->TxDescArrays = tx_ring;
1232
 	vptr->TxDescArrays = tx_ring;
1233
-	if (vptr->TxDescArrays == 0)
1233
+	if (vptr->TxDescArrays == NULL)
1234
 		printf("Allot Error");
1234
 		printf("Allot Error");
1235
 
1235
 
1236
 	/* Tx Descriptor needs 64 bytes alignment; */
1236
 	/* Tx Descriptor needs 64 bytes alignment; */

+ 3
- 3
src/hci/linux_args.c View File

45
 
45
 
46
 /** Supported command-line options */
46
 /** Supported command-line options */
47
 static struct option options[] = {
47
 static struct option options[] = {
48
-	{"net", 1, 0, 'n'},
49
-	{"settings", 1, 0, 's'},
50
-	{0, 0, 0, 0}
48
+	{"net", 1, NULL, 'n'},
49
+	{"settings", 1, NULL, 's'},
50
+	{NULL, 0, NULL, 0}
51
 };
51
 };
52
 
52
 
53
 /**
53
 /**

+ 1
- 1
src/hci/mucurses/kb.c View File

88
 	int c;
88
 	int c;
89
 
89
 
90
 	if ( n == 0 ) {
90
 	if ( n == 0 ) {
91
-		str = '\0';
91
+		*str = '\0';
92
 		return OK;
92
 		return OK;
93
 	}
93
 	}
94
 
94
 

+ 1
- 1
src/net/udp/dns.c View File

205
 	char *fqdn;
205
 	char *fqdn;
206
 
206
 
207
 	/* Leave unchanged if already fully-qualified or no local domain */
207
 	/* Leave unchanged if already fully-qualified or no local domain */
208
-	if ( ( ! localdomain ) || ( strchr ( string, '.' ) != 0 ) )
208
+	if ( ( ! localdomain ) || ( strchr ( string, '.' ) != NULL ) )
209
 		return strdup ( string );
209
 		return strdup ( string );
210
 
210
 
211
 	/* Append local domain to name */
211
 	/* Append local domain to name */

Loading…
Cancel
Save