From 4d24901ac9131267fd188c5e1ee19a219847238a Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Mon, 20 Feb 2017 03:43:12 +0000 Subject: [PATCH] sys/dev: Replace zero with NULL for pointers. Makes things easier to read, plus architectures may set NULL to something different than zero. Found with: devel/coccinelle MFC after: 3 weeks --- sys/dev/agp/agp.c | 2 +- sys/dev/al_eth/al_eth.c | 4 ++-- sys/dev/al_eth/al_init_eth_lm.c | 2 +- sys/dev/an/if_an.c | 2 +- sys/dev/arcmsr/arcmsr.c | 8 ++++---- sys/dev/bce/if_bce.c | 2 +- sys/dev/beri/virtio/virtio_block.c | 2 +- sys/dev/bhnd/cores/usb/bhnd_usb.c | 4 ++-- sys/dev/buslogic/bt_pci.c | 4 ++-- sys/dev/ce/if_ce.c | 4 ++-- sys/dev/cm/smc90cx6.c | 8 ++++---- sys/dev/cp/if_cp.c | 4 ++-- sys/dev/ctau/ctddk.c | 2 +- sys/dev/ctau/if_ct.c | 4 ++-- sys/dev/cx/cxddk.c | 2 +- sys/dev/cx/if_cx.c | 4 ++-- sys/dev/de/if_de.c | 4 ++-- sys/dev/ed/if_ed.c | 2 +- sys/dev/fatm/if_fatm.c | 2 +- sys/dev/fe/if_fe.c | 4 ++-- sys/dev/firewire/if_fwip.c | 2 +- sys/dev/hptiop/hptiop.c | 2 +- sys/dev/hptmv/entry.c | 8 ++++---- sys/dev/hptmv/gui_lib.c | 8 ++++---- sys/dev/hptmv/hptproc.c | 2 +- sys/dev/hptmv/ioctl.c | 2 +- sys/dev/iicbus/if_ic.c | 2 +- sys/dev/isp/isp_pci.c | 16 ++++++++-------- sys/dev/le/am7990.c | 2 +- sys/dev/le/am79900.c | 2 +- sys/dev/le/lance.c | 2 +- sys/dev/md/md.c | 2 +- sys/dev/ncr/ncr.c | 4 ++-- sys/dev/netmap/netmap_freebsd.c | 2 +- sys/dev/netmap/netmap_mem2.c | 2 +- sys/dev/ofw/ofw_bus_subr.c | 2 +- sys/dev/patm/if_patm_tx.c | 2 +- sys/dev/pccard/pccard.c | 6 +++--- sys/dev/pms/RefTisa/sallsdk/spc/sainit.c | 2 +- .../pms/RefTisa/tisa/sassata/common/tdioctl.c | 2 +- sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 8 ++++---- sys/dev/ppbus/if_plip.c | 4 ++-- sys/dev/ppbus/ppbconf.c | 2 +- sys/dev/ppc/ppc.c | 6 +++--- sys/dev/sbni/if_sbni_isa.c | 2 +- sys/dev/sn/if_sn.c | 8 ++++---- sys/dev/sym/sym_hipd.c | 6 +++--- sys/dev/vx/if_vx.c | 4 ++-- 48 files changed, 91 insertions(+), 91 deletions(-) diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 7d024d04724..47c0aaa046c 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -820,7 +820,7 @@ agp_close(struct cdev *kdev, int fflag, int devtype, struct thread *td) /* * Clear the GATT and force release on last close */ - while ((mem = TAILQ_FIRST(&sc->as_memory)) != 0) { + while ((mem = TAILQ_FIRST(&sc->as_memory)) != NULL) { if (mem->am_is_bound) AGP_UNBIND_MEMORY(dev, mem); AGP_FREE_MEMORY(dev, mem); diff --git a/sys/dev/al_eth/al_eth.c b/sys/dev/al_eth/al_eth.c index 6a58fb5c531..79523fd189c 100644 --- a/sys/dev/al_eth/al_eth.c +++ b/sys/dev/al_eth/al_eth.c @@ -2009,7 +2009,7 @@ al_eth_enable_msix(struct al_eth_adapter *adapter) adapter->msix_entries = malloc(msix_vecs*sizeof(*adapter->msix_entries), M_IFAL, M_ZERO | M_WAITOK); - if (adapter->msix_entries == 0) { + if (adapter->msix_entries == NULL) { device_printf_dbg(adapter->dev, "failed to allocate" " msix_entries %d\n", msix_vecs); rc = ENOMEM; @@ -3544,7 +3544,7 @@ al_miibus_linkchg(device_t dev) uint8_t duplex = 0; uint8_t speed = 0; - if (adapter->mii == 0) + if (adapter->mii == NULL) return; if ((adapter->netdev->if_flags & IFF_UP) == 0) diff --git a/sys/dev/al_eth/al_init_eth_lm.c b/sys/dev/al_eth/al_init_eth_lm.c index f6aebda6f10..96da4bb34d9 100644 --- a/sys/dev/al_eth/al_init_eth_lm.c +++ b/sys/dev/al_eth/al_init_eth_lm.c @@ -1168,7 +1168,7 @@ al_eth_lm_link_detection(struct al_eth_lm_context *lm_context, boolean_t lm_pause = lm_context->lm_pause(lm_context->i2c_context); if (lm_pause == TRUE) { *new_mode = AL_ETH_LM_MODE_DISCONNECTED; - if (link_fault != 0) { + if (link_fault != NULL) { if (lm_context->link_state == AL_ETH_LM_LINK_UP) *link_fault = FALSE; else diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index dc3fbf2adf5..cae604c055c 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -3057,7 +3057,7 @@ static void an_cache_store(struct an_softc *sc, struct ether_header *eh, struct mbuf *m, u_int8_t rx_rssi, u_int8_t rx_quality) { - struct ip *ip = 0; + struct ip *ip = NULL; int i; static int cache_slot = 0; /* use this cache entry */ static int wrapindex = 0; /* next "free" cache entry */ diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index 6d6954ea1db..8b0258ba268 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -1398,8 +1398,8 @@ static u_int32_t arcmsr_Read_iop_rqbuffer_data_D(struct AdapterControlBlock *acb struct QBUFFER *prbuffer) { u_int8_t *pQbuffer; - u_int8_t *buf1 = 0; - u_int32_t *iop_data, *buf2 = 0; + u_int8_t *buf1 = NULL; + u_int32_t *iop_data, *buf2 = NULL; u_int32_t iop_len, data_len; iop_data = (u_int32_t *)prbuffer->data; @@ -1494,8 +1494,8 @@ static void arcmsr_Write_data_2iop_wqbuffer_D(struct AdapterControlBlock *acb) { u_int8_t *pQbuffer; struct QBUFFER *pwbuffer; - u_int8_t *buf1 = 0; - u_int32_t *iop_data, *buf2 = 0; + u_int8_t *buf1 = NULL; + u_int32_t *iop_data, *buf2 = NULL; u_int32_t allxfer_len = 0, data_len; if(acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READ) { diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c index 0b406e23cb7..cdf234ee4a5 100644 --- a/sys/dev/bce/if_bce.c +++ b/sys/dev/bce/if_bce.c @@ -2800,7 +2800,7 @@ bce_nvram_write(struct bce_softc *sc, u32 offset, u8 *data_buf, if (align_start || align_end) { buf = malloc(len32, M_DEVBUF, M_NOWAIT); - if (buf == 0) { + if (buf == NULL) { rc = ENOMEM; goto bce_nvram_write_exit; } diff --git a/sys/dev/beri/virtio/virtio_block.c b/sys/dev/beri/virtio/virtio_block.c index 405746c52b5..50bb7f3a53b 100644 --- a/sys/dev/beri/virtio/virtio_block.c +++ b/sys/dev/beri/virtio/virtio_block.c @@ -457,7 +457,7 @@ beri_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, sc->opened = 1; break; case MDIOCDETACH: - if (sc->vnode == 0) { + if (sc->vnode == NULL) { /* File not opened */ return (1); } diff --git a/sys/dev/bhnd/cores/usb/bhnd_usb.c b/sys/dev/bhnd/cores/usb/bhnd_usb.c index f753e5b0d6c..4e88c4a8f94 100644 --- a/sys/dev/bhnd/cores/usb/bhnd_usb.c +++ b/sys/dev/bhnd/cores/usb/bhnd_usb.c @@ -291,7 +291,7 @@ bhnd_usb_alloc_resource(device_t bus, device_t child, int type, int *rid, rv = rman_reserve_resource(&sc->mem_rman, start, end, count, flags, child); - if (rv == 0) { + if (rv == NULL) { BHND_ERROR_DEV(bus, "could not reserve resource"); return (0); } @@ -312,7 +312,7 @@ bhnd_usb_alloc_resource(device_t bus, device_t child, int type, int *rid, rv = rman_reserve_resource(&sc->irq_rman, start, end, count, flags, child); - if (rv == 0) { + if (rv == NULL) { BHND_ERROR_DEV(bus, "could not reserve resource"); return (0); } diff --git a/sys/dev/buslogic/bt_pci.c b/sys/dev/buslogic/bt_pci.c index 7615ae8039a..48c90e08e55 100644 --- a/sys/dev/buslogic/bt_pci.c +++ b/sys/dev/buslogic/bt_pci.c @@ -58,8 +58,8 @@ static int bt_pci_alloc_resources(device_t dev) { int type = 0, rid, zero; - struct resource *regs = 0; - struct resource *irq = 0; + struct resource *regs = NULL; + struct resource *irq = NULL; #if 0 /* XXX Memory Mapped I/O seems to cause problems */ diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c index 69779d6c5e2..541db6ce16c 100644 --- a/sys/dev/ce/if_ce.c +++ b/sys/dev/ce/if_ce.c @@ -840,11 +840,11 @@ static int ce_detach (device_t dev) if (! d || ! d->chan) continue; callout_drain (&d->timeout_handle); - channel [b->num * NCHAN + c->num] = 0; + channel [b->num * NCHAN + c->num] = NULL; /* Deallocate buffers. */ ce_bus_dma_mem_free (&d->dmamem); } - adapter [b->num] = 0; + adapter [b->num] = NULL; ce_bus_dma_mem_free (&bd->dmamem); free (b, M_DEVBUF); #if __FreeBSD_version >= 504000 diff --git a/sys/dev/cm/smc90cx6.c b/sys/dev/cm/smc90cx6.c index 5607298e598..e05f9ee58b8 100644 --- a/sys/dev/cm/smc90cx6.c +++ b/sys/dev/cm/smc90cx6.c @@ -373,7 +373,7 @@ cm_start_locked(ifp) m = arc_frag_next(ifp); buffer = sc->sc_tx_act ^ 1; - if (m == 0) + if (m == NULL) return; #ifdef CM_DEBUG @@ -388,7 +388,7 @@ cm_start_locked(ifp) #endif cm_ram_ptr = buffer * 512; - if (m == 0) + if (m == NULL) return; /* write the addresses to RAM and throw them away */ @@ -505,7 +505,7 @@ cm_srint_locked(vsc) /* Allocate header mbuf */ MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { /* * in case s.th. goes wrong with mem, drop it * to make sure the receiver can be started again @@ -546,7 +546,7 @@ cm_srint_locked(vsc) } } - if (m == 0) { + if (m == NULL) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto cleanup; } diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 426a5eedd60..29643b2ba7f 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -628,11 +628,11 @@ static int cp_detach (device_t dev) if (! d || ! d->chan->type) continue; callout_drain (&d->timeout_handle); - channel [b->num*NCHAN + c->num] = 0; + channel [b->num*NCHAN + c->num] = NULL; /* Deallocate buffers. */ cp_bus_dma_mem_free (&d->dmamem); } - adapter [b->num] = 0; + adapter [b->num] = NULL; cp_bus_dma_mem_free (&bd->dmamem); free (b, M_DEVBUF); mtx_destroy (&bd->cp_mtx); diff --git a/sys/dev/ctau/ctddk.c b/sys/dev/ctau/ctddk.c index 0a9dbd2fd46..cd83311ad52 100644 --- a/sys/dev/ctau/ctddk.c +++ b/sys/dev/ctau/ctddk.c @@ -104,7 +104,7 @@ int ct_open_board (ct_board_t *b, int num, port_t port, int irq, int dma) case B_TAU2_E1D: fw = ctau2_fw_data; flen = 0; - ft = 0; + ft = NULL; break; #ifndef CT_DDK_NO_G703 case B_TAU_G703: diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index a3df2a8c5d2..41975bae1e3 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -839,8 +839,8 @@ static int ct_detach (device_t dev) /* Deallocate buffers. */ ct_bus_dma_mem_free (&d->dmamem); } - bd->board = 0; - adapter [b->num] = 0; + bd->board = NULL; + adapter [b->num] = NULL; free (b, M_DEVBUF); mtx_destroy (&bd->ct_mtx); diff --git a/sys/dev/cx/cxddk.c b/sys/dev/cx/cxddk.c index 94780fb3591..a321000f390 100644 --- a/sys/dev/cx/cxddk.c +++ b/sys/dev/cx/cxddk.c @@ -440,7 +440,7 @@ static int cx_receive_interrupt (cx_chan_t *c) if (c->mode == M_ASYNC && (risr & RISA_TIMEOUT)) { unsigned long rcbadr = (unsigned short) inw (RCBADRL(c->port)) | (long) inw (RCBADRU(c->port)) << 16; - unsigned char *buf = 0; + unsigned char *buf = NULL; port_t cnt_port = 0, sts_port = 0; if (rcbadr >= c->brphys && rcbadr < c->brphys+DMABUFSZ) { diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 654e9136ccd..58fca9fe771 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -991,8 +991,8 @@ static int cx_detach (device_t dev) /* Deallocate buffers. */ cx_bus_dma_mem_free (&d->dmamem); } - bd->board = 0; - adapter [b->num] = 0; + bd->board = NULL; + adapter [b->num] = NULL; free (b, M_DEVBUF); splx (s); diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index a6253f5f5e9..3e56c86258e 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -4887,8 +4887,8 @@ tulip_pci_attach(device_t dev) rid = 0; res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); - if (res == 0 || bus_setup_intr(dev, res, INTR_TYPE_NET | - INTR_MPSAFE, NULL, intr_rtn, sc, &ih)) { + if (res == NULL || bus_setup_intr(dev, res, INTR_TYPE_NET | + INTR_MPSAFE, NULL, intr_rtn, sc, &ih)) { device_printf(dev, "couldn't map interrupt\n"); tulip_busdma_cleanup(sc); ether_ifdetach(sc->tulip_ifp); diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 1fb40379316..0730c964df0 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -751,7 +751,7 @@ outloop: return; } IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - if (m == 0) { + if (m == NULL) { /* * We are using the !OACTIVE flag to indicate to the outside diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c index a530a44327d..2a1dee685c3 100644 --- a/sys/dev/fatm/if_fatm.c +++ b/sys/dev/fatm/if_fatm.c @@ -1501,7 +1501,7 @@ fatm_intr_drain_rx(struct fatm_softc *sc) rpd->nseg = le32toh(rpd->nseg); mlen = 0; - m0 = last = 0; + m0 = last = NULL; for (i = 0; i < rpd->nseg; i++) { rb = sc->rbufs + rpd->segment[i].handle; if (m0 == NULL) { diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index e4a46011a9a..94b83be3f9e 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -2002,7 +2002,7 @@ fe_write_mbufs (struct fe_softc *sc, struct mbuf *m) if ((sc->proto_dlcr6 & FE_D6_SBW) == FE_D6_SBW_BYTE) { /* 8-bit cards are easy. */ - for (mp = m; mp != 0; mp = mp->m_next) { + for (mp = m; mp != NULL; mp = mp->m_next) { if (mp->m_len) fe_outsb(sc, FE_BMPR8, mtod(mp, caddr_t), mp->m_len); @@ -2012,7 +2012,7 @@ fe_write_mbufs (struct fe_softc *sc, struct mbuf *m) { /* 16-bit cards are a pain. */ savebyte = NO_PENDING_BYTE; - for (mp = m; mp != 0; mp = mp->m_next) { + for (mp = m; mp != NULL; mp = mp->m_next) { /* Ignore empty mbuf. */ len = mp->m_len; diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 0a958b2b2c0..3928ef13ae5 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -575,7 +575,7 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp) */ mtag = m_tag_locate(m, MTAG_FIREWIRE, MTAG_FIREWIRE_HWADDR, 0); if (mtag == NULL) - destfw = 0; + destfw = NULL; else destfw = (struct fw_hwaddr *) (mtag + 1); diff --git a/sys/dev/hptiop/hptiop.c b/sys/dev/hptiop/hptiop.c index 81b4c694d6d..a20def6ef00 100644 --- a/sys/dev/hptiop/hptiop.c +++ b/sys/dev/hptiop/hptiop.c @@ -330,7 +330,7 @@ static void hptiop_request_callback_itl(struct hpt_iop_hba * hba, u_int32_t index) { struct hpt_iop_srb *srb; - struct hpt_iop_request_scsi_command *req=0; + struct hpt_iop_request_scsi_command *req=NULL; union ccb *ccb; u_int8_t *cdb; u_int32_t result, temp, dxfer; diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c index b01fc9c917d..167f82a46e8 100644 --- a/sys/dev/hptmv/entry.c +++ b/sys/dev/hptmv/entry.c @@ -138,8 +138,8 @@ static MV_BOOLEAN hptmv_event_notify(MV_SATA_ADAPTER *pMvSataAdapter, static struct sx hptmv_list_lock; SX_SYSINIT(hptmv_list_lock, &hptmv_list_lock, "hptmv list"); -IAL_ADAPTER_T *gIal_Adapter = 0; -IAL_ADAPTER_T *pCurAdapter = 0; +IAL_ADAPTER_T *gIal_Adapter = NULL; +IAL_ADAPTER_T *pCurAdapter = NULL; static MV_SATA_CHANNEL gMvSataChannels[MAX_VBUS][MV_SATA_CHANNELS_NUM]; typedef struct st_HPT_DPC { @@ -1262,7 +1262,7 @@ init_adapter(IAL_ADAPTER_T *pAdapter) sx_xlock(&hptmv_list_lock); pAdapter->next = 0; - if(gIal_Adapter == 0){ + if(gIal_Adapter == NULL){ gIal_Adapter = pAdapter; pCurAdapter = gIal_Adapter; } @@ -2427,7 +2427,7 @@ static void hpt_worker_thread(void) sx_slock(&hptmv_list_lock); pAdapter = gIal_Adapter; - while(pAdapter != 0){ + while(pAdapter != NULL){ mtx_lock(&pAdapter->lock); _vbus_p = &pAdapter->VBus; diff --git a/sys/dev/hptmv/gui_lib.c b/sys/dev/hptmv/gui_lib.c index 359a41edcd3..bc57239c217 100644 --- a/sys/dev/hptmv/gui_lib.c +++ b/sys/dev/hptmv/gui_lib.c @@ -74,7 +74,7 @@ check_VDevice_valid(PVDevice p) PVBus _vbus_p; IAL_ADAPTER_T *pAdapter = gIal_Adapter; - while(pAdapter != 0) + while(pAdapter != NULL) { for (i = 0; i < MV_SATA_CHANNELS_NUM; i++) if(&(pAdapter->VDevices[i]) == p) return 0; @@ -83,7 +83,7 @@ check_VDevice_valid(PVDevice p) #ifdef SUPPORT_ARRAY pAdapter = gIal_Adapter; - while(pAdapter != 0) + while(pAdapter != NULL) { _vbus_p = &pAdapter->VBus; for (i=0;inext; @@ -448,7 +448,7 @@ int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo) IAL_ADAPTER_T *pAdapTemp = gIal_Adapter; int i,iControllerCount = 0; - while(pAdapTemp != 0) + while(pAdapTemp != NULL) { if (iControllerCount++==id) goto found; diff --git a/sys/dev/hptmv/hptproc.c b/sys/dev/hptmv/hptproc.c index 9e897567e07..d9ded9fd0e1 100644 --- a/sys/dev/hptmv/hptproc.c +++ b/sys/dev/hptmv/hptproc.c @@ -427,7 +427,7 @@ static void hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray) { int i; - char *sType=0, *sStatus=0; + char *sType = NULL, *sStatus = NULL; char buf[32]; PVDevice pTmpArray; diff --git a/sys/dev/hptmv/ioctl.c b/sys/dev/hptmv/ioctl.c index 50a82aed1cb..671d64c86bc 100644 --- a/sys/dev/hptmv/ioctl.c +++ b/sys/dev/hptmv/ioctl.c @@ -691,7 +691,7 @@ hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags) PCommand pCmd; UINT result; int needsync=0, retry=0, needdelete=0; - void *buffer = 0; + void *buffer = NULL; _VBUS_INST(&pAdapter->VBus) diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 0df2f4a45ee..323b0f7c29b 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -251,7 +251,7 @@ icioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: - if (ifr == 0) + if (ifr == NULL) return (EAFNOSUPPORT); /* XXX */ switch (ifr->ifr_addr.sa_family) { case AF_INET: diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index b0acd9605b7..8a51cf511a7 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -583,10 +583,10 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp) name, &tval) == 0 && tval != 0) { isp->isp_confopts |= ISP_CFG_FULL_DUPLEX; } - sptr = 0; + sptr = NULL; snprintf(name, sizeof(name), "%stopology", prefix); if (resource_string_value(device_get_name(dev), device_get_unit(dev), - name, (const char **) &sptr) == 0 && sptr != 0) { + name, (const char **) &sptr) == 0 && sptr != NULL) { if (strcmp(sptr, "lport") == 0) { isp->isp_confopts |= ISP_CFG_LPORT; } else if (strcmp(sptr, "nport") == 0) { @@ -631,12 +631,12 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp) * hint replacement to specify WWN strings with a leading * 'w' (e..g w50000000aaaa0001). Sigh. */ - sptr = 0; + sptr = NULL; snprintf(name, sizeof(name), "%sportwwn", prefix); tval = resource_string_value(device_get_name(dev), device_get_unit(dev), name, (const char **) &sptr); - if (tval == 0 && sptr != 0 && *sptr++ == 'w') { - char *eptr = 0; + if (tval == 0 && sptr != NULL && *sptr++ == 'w') { + char *eptr = NULL; ISP_FC_PC(isp, chan)->def_wwpn = strtouq(sptr, &eptr, 16); if (eptr < sptr + 16 || ISP_FC_PC(isp, chan)->def_wwpn == -1) { device_printf(dev, "mangled portwwn hint '%s'\n", sptr); @@ -644,12 +644,12 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp) } } - sptr = 0; + sptr = NULL; snprintf(name, sizeof(name), "%snodewwn", prefix); tval = resource_string_value(device_get_name(dev), device_get_unit(dev), name, (const char **) &sptr); - if (tval == 0 && sptr != 0 && *sptr++ == 'w') { - char *eptr = 0; + if (tval == 0 && sptr != NULL && *sptr++ == 'w') { + char *eptr = NULL; ISP_FC_PC(isp, chan)->def_wwnn = strtouq(sptr, &eptr, 16); if (eptr < sptr + 16 || ISP_FC_PC(isp, chan)->def_wwnn == 0) { device_printf(dev, "mangled nodewwn hint '%s'\n", sptr); diff --git a/sys/dev/le/am7990.c b/sys/dev/le/am7990.c index a21be28a4c1..32c2e1e65e8 100644 --- a/sys/dev/le/am7990.c +++ b/sys/dev/le/am7990.c @@ -519,7 +519,7 @@ am7990_start_locked(struct lance_softc *sc) } IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; /* diff --git a/sys/dev/le/am79900.c b/sys/dev/le/am79900.c index 74f9e5c802f..cb6a31f30b5 100644 --- a/sys/dev/le/am79900.c +++ b/sys/dev/le/am79900.c @@ -557,7 +557,7 @@ am79900_start_locked(struct lance_softc *sc) } IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - if (m == 0) + if (m == NULL) break; /* diff --git a/sys/dev/le/lance.c b/sys/dev/le/lance.c index f8a333b9fd5..2eee7af1b8b 100644 --- a/sys/dev/le/lance.c +++ b/sys/dev/le/lance.c @@ -418,7 +418,7 @@ lance_get(struct lance_softc *sc, int boff, int totlen) totlen -= len; if (totlen > 0) { MGET(newm, M_NOWAIT, MT_DATA); - if (newm == 0) + if (newm == NULL) goto bad; len = MLEN; m = m->m_next = newm; diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index c9c73bfafda..2fd60544914 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -153,7 +153,7 @@ static g_access_t g_md_access; static void g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp __unused, struct g_provider *pp); -static struct cdev *status_dev = 0; +static struct cdev *status_dev = NULL; static struct sx md_sx; static struct unrhdr *md_uh; diff --git a/sys/dev/ncr/ncr.c b/sys/dev/ncr/ncr.c index d6e1ddf637c..e125ee189a8 100644 --- a/sys/dev/ncr/ncr.c +++ b/sys/dev/ncr/ncr.c @@ -5206,7 +5206,7 @@ static void ncr_log_hard_error(ncb_p np, u_short sist, u_char dstat) } else { script_ofs = dsp; script_size = 0; - script_base = 0; + script_base = NULL; script_name = "mem"; } @@ -5809,7 +5809,7 @@ static void ncr_int_sir (ncb_p np) u_char scntl3; u_char chg, ofs, per, fak, wide; u_char num = INB (nc_dsps); - nccb_p cp=0; + nccb_p cp = NULL; u_long dsa; u_int target = INB (nc_sdid) & 0x0f; tcb_p tp = &np->target[target]; diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index f51b8f74caf..fbbd9b35734 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -648,7 +648,7 @@ nm_os_pt_memdev_iomap(struct ptnetmap_memdev *ptn_dev, vm_paddr_t *nm_paddr, &rid, 0, ~0, *mem_size, RF_ACTIVE); if (ptn_dev->pci_mem == NULL) { *nm_paddr = 0; - *nm_addr = 0; + *nm_addr = NULL; return ENOMEM; } diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index ab89d3af65a..922e5f32ff0 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -2143,7 +2143,7 @@ netmap_mem_pt_guest_deref(struct netmap_mem_d *nmd) if (ptnmd->ptn_dev) { nm_os_pt_memdev_iounmap(ptnmd->ptn_dev); } - ptnmd->nm_addr = 0; + ptnmd->nm_addr = NULL; ptnmd->nm_paddr = 0; } } diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c index 84adfa14d17..01f5549bf33 100644 --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -963,7 +963,7 @@ ofw_bus_string_list_to_array(phandle_t node, const char *list_name, i += len; tptr += len; } - array[cnt] = 0; + array[cnt] = NULL; *out_array = array; return (cnt); diff --git a/sys/dev/patm/if_patm_tx.c b/sys/dev/patm/if_patm_tx.c index 1b9a8a50a1d..33ee8f183a2 100644 --- a/sys/dev/patm/if_patm_tx.c +++ b/sys/dev/patm/if_patm_tx.c @@ -440,7 +440,7 @@ patm_tx_pad(struct patm_softc *sc, struct mbuf *m0) } } MGET(m, M_NOWAIT, MT_DATA); - if (m == 0) { + if (m == NULL) { m_freem(m0); if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (NULL); diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 04dcc44bef7..4c80feae63e 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -470,7 +470,7 @@ pccard_function_init(struct pccard_function *pf, int entry) struct pccard_ivar *devi = PCCARD_IVAR(pf->dev); struct resource_list *rl = &devi->resources; struct resource_list_entry *rle; - struct resource *r = 0; + struct resource *r = NULL; struct pccard_ce_iospace *ios; struct pccard_ce_memspace *mems; device_t bus; @@ -1115,7 +1115,7 @@ pccard_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pccard_ivar *dinfo; - struct resource_list_entry *rle = 0; + struct resource_list_entry *rle = NULL; int passthrough = (device_get_parent(child) != dev); int isdefault = (RMAN_IS_DEFAULT_RANGE(start, end) && count == 1); struct resource *r = NULL; @@ -1165,7 +1165,7 @@ pccard_release_resource(device_t dev, device_t child, int type, int rid, { struct pccard_ivar *dinfo; int passthrough = (device_get_parent(child) != dev); - struct resource_list_entry *rle = 0; + struct resource_list_entry *rle = NULL; if (passthrough) return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, diff --git a/sys/dev/pms/RefTisa/sallsdk/spc/sainit.c b/sys/dev/pms/RefTisa/sallsdk/spc/sainit.c index 367c75ab644..6e112adb95a 100644 --- a/sys/dev/pms/RefTisa/sallsdk/spc/sainit.c +++ b/sys/dev/pms/RefTisa/sallsdk/spc/sainit.c @@ -48,7 +48,7 @@ bit32 gLLSoftResetCounter = 0; bit32 gPollForMissingInt; #ifdef FW_EVT_LOG_TST -void *eventLogAddress = 0; +void *eventLogAddress = NULL; #endif extern bit32 gWait_3; diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c index f1926806bfd..f1ee7927c9d 100644 --- a/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c +++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c @@ -379,7 +379,7 @@ tiCOMMgntIOCTL( bit32 Offset = 0; bit32 RequestLength = 0; /* user request on how much data to pass to application */ agsaContext_t *agContext = NULL; - bit8 *loc = 0; + bit8 *loc = NULL; TI_DBG3(("tiCOMMgntIOCTL: start\n")); diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c index 2f5f963611f..ac96eada975 100644 --- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c +++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c @@ -5032,7 +5032,7 @@ STATIC void agtiapi_PrepCCBs( struct agtiapi_softc *pCard, int i; U32 hdr_sz, ccb_sz; - ccb_t *pccb = 0; + ccb_t *pccb = NULL; int offset = 0; int nsegs = 0; int sgl_sz = 0; @@ -5159,7 +5159,7 @@ STATIC U32 agtiapi_InitCCBs(struct agtiapi_softc *pCard, int tgtCount, int tid) U32 max_ccb, size, ccb_sz, hdr_sz; int no_allocs = 0, i; - ccb_hdr_t *hdr = 0; + ccb_hdr_t *hdr = NULL; AGTIAPI_PRINTK("agtiapi_InitCCBs: start\n"); AGTIAPI_PRINTK("agtiapi_InitCCBs: tgtCount %d tid %d\n", tgtCount, tid); @@ -5395,7 +5395,7 @@ STATIC U32 agtiapi_GetDevHandle( struct agtiapi_softc *pCard, for ( devIdx = 0; devIdx < pCard->devDiscover; devIdx++ ) { - if ( agDev[devIdx] != 0 ) + if ( agDev[devIdx] != NULL ) { // AGTIAPI_PRINTK( "agtiapi_GetDevHandle: agDev %d not NULL %p\n", // devIdx, agDev[devIdx] ); @@ -5820,7 +5820,7 @@ STATIC void agtiapi_ReleaseCCBs( struct agtiapi_softc *pCard ) ccb_hdr_t *hdr; U32 hdr_sz; - ccb_t *pccb = 0; + ccb_t *pccb = NULL; AGTIAPI_PRINTK( "agtiapi_ReleaseCCBs: start\n" ); diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index 93a0da17307..7a9d9b0e457 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -245,7 +245,7 @@ lp_attach(device_t dev) */ lp->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE); - if (lp->res_irq == 0) { + if (lp->res_irq == NULL) { device_printf(dev, "cannot reserve interrupt, failed.\n"); return (ENXIO); } @@ -453,7 +453,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: - if (ifr == 0) { + if (ifr == NULL) { return (EAFNOSUPPORT); /* XXX */ } switch (ifr->ifr_addr.sa_family) { diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c index a2370dde098..b5b74b46243 100644 --- a/sys/dev/ppbus/ppbconf.c +++ b/sys/dev/ppbus/ppbconf.c @@ -206,7 +206,7 @@ search_token(char *str, int slen, char *token) static int ppb_pnp_detect(device_t bus) { - char *token, *class = 0; + char *token, *class = NULL; int i, len, error; int class_id = -1; char str[PPB_PnP_STRING_SIZE+1]; diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 9515039036d..cd9cf214876 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1324,9 +1324,9 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) register int reg; register char mask; register int accum = 0; - register char *ptr = 0; + register char *ptr = NULL; - struct ppb_microseq *stack = 0; + struct ppb_microseq *stack = NULL; /* microsequence registers are equivalent to PC-like port registers */ @@ -1496,7 +1496,7 @@ ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) mi = stack; /* reset the stack */ - stack = 0; + stack = NULL; /* XXX return code */ diff --git a/sys/dev/sbni/if_sbni_isa.c b/sys/dev/sbni/if_sbni_isa.c index 61a239841b1..f1db8b1a984 100644 --- a/sys/dev/sbni/if_sbni_isa.c +++ b/sys/dev/sbni/if_sbni_isa.c @@ -132,7 +132,7 @@ sbni_attach_isa(device_t dev) } else { struct sbni_softc *master; - if ((master = connect_to_master(sc)) == 0) { + if ((master = connect_to_master(sc)) == NULL) { device_printf(dev, "failed to alloc irq\n"); sbni_release_resources(sc); return (ENXIO); diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 7ac2a13170c..0306089c862 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -393,7 +393,7 @@ startagain: * Sneak a peek at the next packet */ m = ifp->if_snd.ifq_head; - if (m == 0) + if (m == NULL) return; /* * Compute the frame length and set pad to give an overall even @@ -509,7 +509,7 @@ startagain: /* * Push out the data to the card. */ - for (top = m; m != 0; m = m->m_next) { + for (top = m; m != NULL; m = m->m_next) { /* * Push out words. @@ -607,7 +607,7 @@ snresume(struct ifnet *ifp) * Sneak a peek at the next packet */ m = ifp->if_snd.ifq_head; - if (m == 0) { + if (m == NULL) { if_printf(ifp, "snresume() with nothing to send\n"); return; } @@ -708,7 +708,7 @@ snresume(struct ifnet *ifp) /* * Push out the data to the card. */ - for (top = m; m != 0; m = m->m_next) { + for (top = m; m != NULL; m = m->m_next) { /* * Push out words. diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 76e658f5ee9..a9c2070aeec 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -3710,7 +3710,7 @@ static void sym_log_hard_error(hcb_p np, u_short sist, u_char dstat) } else { script_ofs = dsp; script_size = 0; - script_base = 0; + script_base = NULL; script_name = "mem"; } @@ -4296,7 +4296,7 @@ static void sym_int_ma (hcb_p np) * try to find the interrupted script command, * and the address at which to continue. */ - vdsp = 0; + vdsp = NULL; nxtdsp = 0; if (dsp > np->scripta_ba && dsp <= np->scripta_ba + np->scripta_sz) { @@ -6673,7 +6673,7 @@ static void sym_alloc_lcb_tags (hcb_p np, u_char tn, u_char ln) lp->cb_tags = sym_calloc(SYM_CONF_MAX_TASK, "CB_TAGS"); if (!lp->cb_tags) { sym_mfree_dma(lp->itlq_tbl, SYM_CONF_MAX_TASK*4, "ITLQ_TBL"); - lp->itlq_tbl = 0; + lp->itlq_tbl = NULL; return; } diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index 08d84a64f28..a1ba239a7b9 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -350,7 +350,7 @@ vx_setlink(struct vx_softc *sc) */ i = sc->vx_connector; /* default in EEPROM */ reason = "default"; - warning = 0; + warning = NULL; if (ifp->if_flags & IFF_LINK0) { if (sc->vx_connectors & conn_tab[CONNECTOR_AUI].bit) { @@ -729,7 +729,7 @@ again: /* Pull packet off interface. */ m = vx_get(sc, len); - if (m == 0) { + if (m == NULL) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto abort; }