From owner-svn-src-head@freebsd.org Wed Feb 22 02:36:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5F25CE9A6C; Wed, 22 Feb 2017 02:36:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C09521568; Wed, 22 Feb 2017 02:36:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1M2a1Rb010509; Wed, 22 Feb 2017 02:36:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1M2a0im010487; Wed, 22 Feb 2017 02:36:00 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201702220236.v1M2a0im010487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 22 Feb 2017 02:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314068 - in head/sys: amd64/amd64 boot/common boot/efi/libefi boot/fdt boot/ficl boot/kshim boot/ofw/libofw boot/sparc64/loader boot/userboot/userboot boot/zfs libkern mips/atheros/ar5... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 02:36:03 -0000 Author: pfg Date: Wed Feb 22 02:35:59 2017 New Revision: 314068 URL: https://svnweb.freebsd.org/changeset/base/314068 Log: sys: Replace zero with NULL for pointers. Found with: devel/coccinelle MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D9694 Modified: head/sys/amd64/amd64/db_disasm.c head/sys/amd64/amd64/pmap.c head/sys/boot/common/md.c head/sys/boot/efi/libefi/efinet.c head/sys/boot/fdt/fdt_overlay.c head/sys/boot/ficl/ficl.c head/sys/boot/kshim/bsd_kernel.c head/sys/boot/ofw/libofw/ofw_memory.c head/sys/boot/sparc64/loader/main.c head/sys/boot/userboot/userboot/userboot_disk.c head/sys/boot/zfs/zfs.c head/sys/boot/zfs/zfsimpl.c head/sys/libkern/iconv_xlat16.c head/sys/mips/atheros/ar531x/apb.c head/sys/net/if_fddisubr.c head/sys/net/if_iso88025subr.c head/sys/net/iflib.c head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/amd64/amd64/db_disasm.c ============================================================================== --- head/sys/amd64/amd64/db_disasm.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/amd64/amd64/db_disasm.c Wed Feb 22 02:35:59 2017 (r314068) @@ -1044,7 +1044,7 @@ db_read_address(loc, short_addr, rex, re return (loc); } addrp->is_reg = FALSE; - addrp->index = 0; + addrp->index = NULL; if (short_addr) size = LONG; @@ -1067,7 +1067,7 @@ db_read_address(loc, short_addr, rex, re if (rm == 5) { get_value_inc(addrp->disp, loc, 4, FALSE); if (have_sib) - addrp->base = 0; + addrp->base = NULL; else if (short_addr) addrp->base = "%eip"; else @@ -1109,9 +1109,9 @@ db_print_address(seg, size, rex, addrp) db_printf("%s:", seg); } - if (addrp->disp != 0 || (addrp->base == 0 && addrp->index == 0)) + if (addrp->disp != 0 || (addrp->base == NULL && addrp->index == NULL)) db_printsym((db_addr_t)addrp->disp, DB_STGY_ANY); - if (addrp->base != 0 || addrp->index != 0) { + if (addrp->base != NULL || addrp->index != NULL) { db_printf("("); if (addrp->base) db_printf("%s", addrp->base); @@ -1248,7 +1248,7 @@ db_disasm(db_addr_t loc, bool altfmt) get_value_inc(inst, loc, 1, FALSE); short_addr = FALSE; size = LONG; - seg = 0; + seg = NULL; /* * Get prefixes @@ -1313,7 +1313,7 @@ db_disasm(db_addr_t loc, bool altfmt) while (ip->i_size == ESC) { get_value_inc(inst, loc, 1, FALSE); ip = ((const struct inst * const *)ip->i_extra)[inst>>4]; - if (ip == 0) { + if (ip == NULL) { ip = &db_bad_inst; } else { Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/amd64/amd64/pmap.c Wed Feb 22 02:35:59 2017 (r314068) @@ -391,7 +391,7 @@ static struct md_page pv_dummy; /* * All those kernel PT submaps that BSD is so fond of */ -pt_entry_t *CMAP1 = 0; +pt_entry_t *CMAP1 = NULL; caddr_t CADDR1 = 0; static vm_offset_t qframe = 0; static struct mtx qframe_mtx; Modified: head/sys/boot/common/md.c ============================================================================== --- head/sys/boot/common/md.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/common/md.c Wed Feb 22 02:35:59 2017 (r314068) @@ -103,7 +103,7 @@ md_strategy(void *devdata, int rw, daddr if ((ofs + size) > MD_IMAGE_SIZE) size = MD_IMAGE_SIZE - ofs; - if (rsize != 0) + if (rsize != NULL) *rsize = size; switch (rw) { Modified: head/sys/boot/efi/libefi/efinet.c ============================================================================== --- head/sys/boot/efi/libefi/efinet.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/efi/libefi/efinet.c Wed Feb 22 02:35:59 2017 (r314068) @@ -131,13 +131,13 @@ efinet_put(struct iodesc *desc, void *pk /* Wait for the buffer to be transmitted */ do { - buf = 0; /* XXX Is this needed? */ + buf = NULL; /* XXX Is this needed? */ status = net->GetStatus(net, 0, &buf); /* * XXX EFI1.1 and the E1000 card returns a different * address than we gave. Sigh. */ - } while (status == EFI_SUCCESS && buf == 0); + } while (status == EFI_SUCCESS && buf == NULL); /* XXX How do we deal with status != EFI_SUCCESS now? */ return ((status == EFI_SUCCESS) ? len : -1); Modified: head/sys/boot/fdt/fdt_overlay.c ============================================================================== --- head/sys/boot/fdt/fdt_overlay.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/fdt/fdt_overlay.c Wed Feb 22 02:35:59 2017 (r314068) @@ -64,7 +64,7 @@ fdt_get_fixup_location(void *fdtp, const int prop_offset, o, proplen; void *result; - result = 0; + result = NULL; path = strdup(fixup); prop = strchr(path, ':'); Modified: head/sys/boot/ficl/ficl.c ============================================================================== --- head/sys/boot/ficl/ficl.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/ficl/ficl.c Wed Feb 22 02:35:59 2017 (r314068) @@ -276,7 +276,7 @@ void ficlFreeVM(FICL_VM *pVM) FICL_SYSTEM *pSys = pVM->pSys; FICL_VM *pList = pSys->vmList; - assert(pVM != 0); + assert(pVM != NULL); if (pSys->vmList == pVM) { Modified: head/sys/boot/kshim/bsd_kernel.c ============================================================================== --- head/sys/boot/kshim/bsd_kernel.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/kshim/bsd_kernel.c Wed Feb 22 02:35:59 2017 (r314068) @@ -75,7 +75,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi void *addr; addr = malloc(dmat->maxsize + dmat->alignment, XXX, XXX); - if (addr == 0) + if (addr == NULL) return (ENOMEM); *mapp = addr; Modified: head/sys/boot/ofw/libofw/ofw_memory.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_memory.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/ofw/libofw/ofw_memory.c Wed Feb 22 02:35:59 2017 (r314068) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "openfirm.h" -static void *heap_base = 0; +static void *heap_base = NULL; static unsigned int heap_size = 0; struct ofw_mapping { Modified: head/sys/boot/sparc64/loader/main.c ============================================================================== --- head/sys/boot/sparc64/loader/main.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/sparc64/loader/main.c Wed Feb 22 02:35:59 2017 (r314068) @@ -859,7 +859,7 @@ main(int (*openfirm)(void *)) /* * Initialize devices. */ - for (dp = devsw; *dp != 0; dp++) + for (dp = devsw; *dp != NULL; dp++) if ((*dp)->dv_init != 0) (*dp)->dv_init(); Modified: head/sys/boot/userboot/userboot/userboot_disk.c ============================================================================== --- head/sys/boot/userboot/userboot/userboot_disk.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/userboot/userboot/userboot_disk.c Wed Feb 22 02:35:59 2017 (r314068) @@ -91,8 +91,8 @@ userdisk_init(void) return (ENOMEM); for (i = 0; i < userdisk_maxunit; i++) { if (CALLBACK(diskioctl, i, DIOCGSECTORSIZE, - §orsize) != 0 || CALLBACK(diskioctl, i, - DIOCGMEDIASIZE, &mediasize) != 0) + §orsize) != NULL || CALLBACK(diskioctl, i, + DIOCGMEDIASIZE, &mediasize) != NULL) return (ENXIO); ud_info[i].mediasize = mediasize; ud_info[i].sectorsize = sectorsize; Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/zfs/zfs.c Wed Feb 22 02:35:59 2017 (r314068) @@ -126,7 +126,7 @@ zfs_close(struct open_file *f) { struct file *fp = (struct file *)f->f_fsdata; - dnode_cache_obj = 0; + dnode_cache_obj = NULL; f->f_fsdata = (void *)0; if (fp == (struct file *)0) return (0); Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/boot/zfs/zfsimpl.c Wed Feb 22 02:35:59 2017 (r314068) @@ -69,7 +69,7 @@ static const char *features_for_read[] = static spa_list_t zfs_pools; static uint64_t zfs_crc64_table[256]; -static const dnode_phys_t *dnode_cache_obj = 0; +static const dnode_phys_t *dnode_cache_obj = NULL; static uint64_t dnode_cache_bn; static char *dnode_cache_buf; static char *zap_scratch; @@ -1527,7 +1527,7 @@ fzap_lookup(const spa_t *spa, const dnod zc = &ZAP_LEAF_CHUNK(&zl, h); while (zc->l_entry.le_hash != hash) { if (zc->l_entry.le_next == 0xffff) { - zc = 0; + zc = NULL; break; } zc = &ZAP_LEAF_CHUNK(&zl, zc->l_entry.le_next); @@ -2316,7 +2316,7 @@ zfs_lookup(const struct zfsmount *mount, p = q; } else { strcpy(element, p); - p = 0; + p = NULL; } rc = zfs_dnode_stat(spa, &dn, &sb); Modified: head/sys/libkern/iconv_xlat16.c ============================================================================== --- head/sys/libkern/iconv_xlat16.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/libkern/iconv_xlat16.c Wed Feb 22 02:35:59 2017 (r314068) @@ -268,7 +268,7 @@ iconv_xlat16_conv(void *d2p, const char * there is a case that inbuf char is a single * byte char while inlen == 2 */ - if ((u_char)*(src+1) == 0 && !nullin ) { + if ((u_char)*(src+1) == '\0' && !nullin ) { src++; ir--; } else { Modified: head/sys/mips/atheros/ar531x/apb.c ============================================================================== --- head/sys/mips/atheros/ar531x/apb.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/mips/atheros/ar531x/apb.c Wed Feb 22 02:35:59 2017 (r314068) @@ -329,7 +329,7 @@ apb_alloc_resource(device_t bus, device_ } rv = rman_reserve_resource(rm, start, end, count, flags, child); - if (rv == 0) { + if (rv == NULL) { printf("%s: could not reserve resource %d\n", __func__, type); return (0); } Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/net/if_fddisubr.c Wed Feb 22 02:35:59 2017 (r314068) @@ -400,7 +400,7 @@ fddi_input(ifp, m) m_adj(m, FDDI_HDR_LEN); m = m_pullup(m, LLC_SNAPFRAMELEN); - if (m == 0) { + if (m == NULL) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto dropanyway; } Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/net/if_iso88025subr.c Wed Feb 22 02:35:59 2017 (r314068) @@ -487,7 +487,7 @@ iso88025_input(ifp, m) m_adj(m, mac_hdr_len); m = m_pullup(m, LLC_SNAPFRAMELEN); - if (m == 0) { + if (m == NULL) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto dropanyway; } Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/net/iflib.c Wed Feb 22 02:35:59 2017 (r314068) @@ -1003,7 +1003,7 @@ iflib_netmap_txq_init(if_ctx_t ctx, ifli struct netmap_slot *slot; slot = netmap_reset(na, NR_TX, txq->ift_id, 0); - if (slot == 0) + if (slot == NULL) return; for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) { @@ -1028,7 +1028,7 @@ iflib_netmap_rxq_init(if_ctx_t ctx, ifli int nrxd; slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); - if (slot == 0) + if (slot == NULL) return; map = rxq->ifr_fl[0].ifl_sds.ifsd_map; nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Feb 22 02:24:42 2017 (r314067) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Feb 22 02:35:59 2017 (r314068) @@ -3135,7 +3135,7 @@ int classify_opcode_kidx(ipfw_insn *cmd, uint16_t *puidx) { - if (find_op_rw(cmd, puidx, NULL) == 0) + if (find_op_rw(cmd, puidx, NULL) == NULL) return (1); return (0); }