]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Fix uses of literal 0 as a NULL pointer
authorMichael Brown <mcb30@ipxe.org>
Sun, 28 Apr 2013 15:51:05 +0000 (16:51 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 28 Apr 2013 16:13:44 +0000 (17:13 +0100)
Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
13 files changed:
src/drivers/net/3c515.c
src/drivers/net/3c595.c
src/drivers/net/bnx2.c
src/drivers/net/etherfabric.c
src/drivers/net/ns8390.c
src/drivers/net/prism2.c
src/drivers/net/sis900.c
src/drivers/net/tlan.c
src/drivers/net/tulip.c
src/drivers/net/via-velocity.c
src/hci/linux_args.c
src/hci/mucurses/kb.c
src/net/udp/dns.c

index 0aa68b1aa79142f425b8e4cf55154dcbcf85b385..1591e06175beba7aa0edba3797984a17d847355d 100644 (file)
@@ -389,7 +389,7 @@ static void t515_reset(struct nic *nic)
                outb(PKT_BUF_SZ >> 8, nic->ioaddr + TxFreeThreshold);   /* Room for a packet. */
                /* Clear the Tx ring. */
                for (i = 0; i < TX_RING_SIZE; i++)
-                       vp->tx_skbuff[i] = 0;
+                       vp->tx_skbuff[i] = NULL;
                outl(0, nic->ioaddr + DownListPtr);
        }
        /* Set receiver mode: presumably accept b-case and phys addr only. */
index 1aa8ed641dc0e05f14906696b0a20531fc8b799a..2338c54b79aadeb3e03c34a09e01095f53cd376a 100644 (file)
@@ -399,7 +399,7 @@ vxsetlink(void)
 
     i = vx_connector;       /* default in EEPROM */
     reason = "default";
-    warning = 0;
+    warning = NULL;
 
     if ((vx_connectors & conn_tab[vx_connector].bit) == 0) {
         warning = "strange connector type in EEPROM.";
@@ -407,7 +407,7 @@ vxsetlink(void)
         i = CONNECTOR_UTP;
     }
 
-        if (warning != 0) {
+        if (warning) {
             printf("warning: %s\n", warning);
         }
         printf("selected %s. (%s)\n", conn_tab[i].name, reason);
index a986bdef777f5bed47b5bafb6fd4e07b7f67ca7f..4ebcc52a96a4737b0d2d283a9ecdbd0ccc5adffb 100644 (file)
@@ -2617,9 +2617,6 @@ bnx2_probe(struct nic *nic, struct pci_device *pdev)
        struct bnx2 *bp = &bnx2;
        int i, rc;
 
-       if (pdev == 0)
-               return 0;
-
        memset(bp, 0, sizeof(*bp));
 
        rc = bnx2_init_board(pdev, nic);
index 6036d32169985e65378320a0ba27829fd10d82e9..5e0efb1e1892b33e0994f3c6fef7b499fbdeb417 100644 (file)
@@ -3798,7 +3798,8 @@ falcon_clear_interrupts ( struct efab_nic *efab )
        }
        else {
                /* write to the INT_ACK register */
-               falcon_writel ( efab, 0, FCN_INT_ACK_KER_REG_A1 );
+               EFAB_ZERO_DWORD ( reg );
+               falcon_writel ( efab, &reg, FCN_INT_ACK_KER_REG_A1 );
                mb();
                falcon_readl ( efab, &reg,
                               WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );
index a30f93616aa1b33dd4fbb1b49a9c07873aa4a4c7..0ffc6216ba2f62c081cc856844bd02bfcdbe54ab 100644 (file)
@@ -895,7 +895,7 @@ static int eth_probe (struct dev *dev, unsigned short *probe_addrs __unused)
 #endif
                        0 };
                /* if no addresses supplied, fall back on defaults */
-               if (probe_addrs == 0 || probe_addrs[0] == 0)
+               if (probe_addrs == NULL || probe_addrs[0] == 0)
                        probe_addrs = base;
                eth_bmem = 0;           /* No shared memory */
                for (idx = 0; (eth_nic_base = probe_addrs[idx]) != 0; ++idx) {
index ad388074e2aaf061b76d188f3a5f6ceb5cb1084c..ab974264c7348e41029b9faef88e47f2dc069739 100644 (file)
@@ -130,9 +130,7 @@ typedef struct hfa384x
 } hfa384x_t;
 
 /* The global instance of the hardware (i.e. where we store iobase and membase, in the absence of anywhere better to put them */
-static hfa384x_t hw_global = {
-  0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0}
-};
+static hfa384x_t hw_global;
 
 /*
  * 802.11 headers in addition to those in hfa384x_tx_frame_t (LLC and SNAP)
index 75e9ef962e4cc74ca042a1774c78aaf51fe25763..724515672a2ead234840466e03b038ba79973ae3 100644 (file)
@@ -111,7 +111,7 @@ static struct mii_chip_info {
 //  {"NS 83851 PHY",0x2000, 0x5C20, MIX },
     {"RTL 8201 10/100Mbps Phyceiver"   , 0x0000, 0x8200,rtl8201_read_mode},
     {"VIA 6103 10/100Mbps Phyceiver", 0x0101, 0x8f20,vt6103_read_mode},
-    {0,0,0,0}
+    {NULL,0,0,NULL}
 };
 
 static struct mii_phy {
index 74398df42dcae15d8359395350376d3213205d16..7742f6d80975211aeeec04bf9e93548a56752022 100644 (file)
@@ -94,7 +94,7 @@ static void TLan_MiiWriteReg(struct nic *nic __unused, u16, u16, u16);
 
 static const char *media[] = {
        "10BaseT-HD ", "10BaseT-FD ", "100baseTx-HD ",
-       "100baseTx-FD", "100baseT4", 0
+       "100baseTx-FD", "100baseT4", NULL
 };
 
 /* This much match tlan_pci_tbl[]!  */
@@ -164,7 +164,7 @@ static const struct pci_id_info tlan_pci_tbl[] = {
        {"Compaq NetFlex-3/E", 0,       /* EISA card */
         {0, 0, 0, 0, 0, 0},
         TLAN_ADAPTER_ACTIVITY_LED, 0x83},
-       {0, 0,
+       {NULL, 0,
         {0, 0, 0, 0, 0, 0},
         0, 0},
 };
index 7a23b7e9e244f319c43bb5726a885b1209b502ff..e4e6ffa873271ecaad014efd8ce08a0bd5c62a7a 100644 (file)
@@ -228,7 +228,7 @@ static const struct pci_id_info pci_id_tbl[] = {
       TULIP_IOTYPE, TULIP_SIZE, COMET },
     { "SG Thomson STE10/100A", { 0x2774104a, 0xffffffff, 0, 0, 0, 0 },
       TULIP_IOTYPE, 256, COMET },      /*Ramesh Chander*/
-    { 0, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 },
+    { NULL, { 0, 0, 0, 0, 0, 0 }, 0, 0, 0 },
 };
 
 enum tbl_flag {
@@ -264,7 +264,7 @@ static struct tulip_chip_table {
     { "Xircom tulip work-alike", HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII 
       | HAS_PWRDWN | HAS_NWAY },
     { "SGThomson STE10/100A", HAS_MII | MC_HASH_ONLY },        /*Ramesh Chander*/   
-    { 0, 0 },
+    { NULL, 0 },
 };
 
 /* A full-duplex map for media types. */
@@ -475,7 +475,7 @@ static struct fixups {
                                     0x1B03, 0x006D, /* 100baseTx, CSR12 0x1B */
                                     0x1B05, 0x006D, /* 100baseTx-FD CSR12 0x1B */
     }},
-    {0, 0, 0, 0, {}}};
+    {NULL, 0, 0, 0, {}}};
 
 static const char * block_name[] = {"21140 non-MII", "21140 MII PHY",
                                     "21142 Serial PHY", "21142 MII PHY", "21143 SYM PHY", "21143 reset method"};
@@ -720,7 +720,7 @@ static void parse_eeprom(struct nic *nic)
 
     whereami("parse_eeprom\n");
 
-    tp->mtable = 0;
+    tp->mtable = NULL;
     /* Detect an old-style (SA only) EEPROM layout:
        memcmp(ee_data, ee_data+16, 8). */
     for (i = 0; i < 8; i ++)
index 9ba0b093d2f40fd087e6937518c74fdf4fd8a1d8..e98e81a2a10e60b04c0c46d6115e9976f15aa22a 100644 (file)
@@ -1230,7 +1230,7 @@ static int velocity_open(struct nic *nic, struct pci_device *pci __unused)
        u32 TxPhyAddr, RxPhyAddr;
        u32 TxBufPhyAddr, RxBufPhyAddr;
        vptr->TxDescArrays = tx_ring;
-       if (vptr->TxDescArrays == 0)
+       if (vptr->TxDescArrays == NULL)
                printf("Allot Error");
 
        /* Tx Descriptor needs 64 bytes alignment; */
index 0bce4af9c2f2d5f794264db0de3a8118d3d4754f..58eeb063ec3ae2c87dcdef7a750a2df3bffe6f8a 100644 (file)
@@ -45,9 +45,9 @@ __asmcall void save_args(int argc, char **argv)
 
 /** Supported command-line options */
 static struct option options[] = {
-       {"net", 1, 0, 'n'},
-       {"settings", 1, 0, 's'},
-       {0, 0, 0, 0}
+       {"net", 1, NULL, 'n'},
+       {"settings", 1, NULL, 's'},
+       {NULL, 0, NULL, 0}
 };
 
 /**
index cada729176d17e6eee15138890a8305226044b8a..b38c8c1465a1acb8c14261657b8fde81ccba9a60 100644 (file)
@@ -88,7 +88,7 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
        int c;
 
        if ( n == 0 ) {
-               str = '\0';
+               *str = '\0';
                return OK;
        }
 
index 613541f5a11c735deeb37a3844e48df2bd1bc59b..45f0f07c1d222d2405b0f58a1318b12f1a95629c 100644 (file)
@@ -205,7 +205,7 @@ static char * dns_qualify_name ( const char *string ) {
        char *fqdn;
 
        /* Leave unchanged if already fully-qualified or no local domain */
-       if ( ( ! localdomain ) || ( strchr ( string, '.' ) != 0 ) )
+       if ( ( ! localdomain ) || ( strchr ( string, '.' ) != NULL ) )
                return strdup ( string );
 
        /* Append local domain to name */