Переглянути джерело

[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 роки тому
джерело
коміт
b9663b8049

+ 1
- 1
src/drivers/net/3c515.c Переглянути файл

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

+ 2
- 2
src/drivers/net/3c595.c Переглянути файл

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

+ 0
- 3
src/drivers/net/bnx2.c Переглянути файл

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

+ 2
- 1
src/drivers/net/etherfabric.c Переглянути файл

@@ -3798,7 +3798,8 @@ falcon_clear_interrupts ( struct efab_nic *efab )
3798 3798
 	}
3799 3799
 	else {
3800 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 3803
 		mb();
3803 3804
 		falcon_readl ( efab, &reg,
3804 3805
 			       WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );

+ 1
- 1
src/drivers/net/ns8390.c Переглянути файл

@@ -895,7 +895,7 @@ static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused)
895 895
 #endif
896 896
 			0 };
897 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 899
 			probe_addrs = base;
900 900
 		eth_bmem = 0;		/* No shared memory */
901 901
 		for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {

+ 1
- 3
src/drivers/net/prism2.c Переглянути файл

@@ -130,9 +130,7 @@ typedef struct hfa384x
130 130
 } hfa384x_t;
131 131
 
132 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 136
  * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)

+ 1
- 1
src/drivers/net/sis900.c Переглянути файл

@@ -111,7 +111,7 @@ static struct mii_chip_info {
111 111
 //  {"NS 83851 PHY",0x2000, 0x5C20, MIX },
112 112
     {"RTL 8201 10/100Mbps Phyceiver"   , 0x0000, 0x8200,rtl8201_read_mode},
113 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 117
 static struct mii_phy {

+ 2
- 2
src/drivers/net/tlan.c Переглянути файл

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

+ 4
- 4
src/drivers/net/tulip.c Переглянути файл

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

+ 1
- 1
src/drivers/net/via-velocity.c Переглянути файл

@@ -1230,7 +1230,7 @@ static int velocity_open(struct nic *nic, struct pci_device *pci __unused)
1230 1230
 	u32 TxPhyAddr, RxPhyAddr;
1231 1231
 	u32 TxBufPhyAddr, RxBufPhyAddr;
1232 1232
 	vptr->TxDescArrays = tx_ring;
1233
-	if (vptr->TxDescArrays == 0)
1233
+	if (vptr->TxDescArrays == NULL)
1234 1234
 		printf("Allot Error");
1235 1235
 
1236 1236
 	/* Tx Descriptor needs 64 bytes alignment; */

+ 3
- 3
src/hci/linux_args.c Переглянути файл

@@ -45,9 +45,9 @@ __asmcall void save_args(int argc, char **argv)
45 45
 
46 46
 /** Supported command-line options */
47 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 Переглянути файл

@@ -88,7 +88,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
88 88
 	int c;
89 89
 
90 90
 	if ( n == 0 ) {
91
-		str = '\0';
91
+		*str = '\0';
92 92
 		return OK;
93 93
 	}
94 94
 

+ 1
- 1
src/net/udp/dns.c Переглянути файл

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

Завантаження…
Відмінити
Зберегти