From 914b334caa4993ed40bff3051e312b79618549cb Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Thu, 18 Apr 2019 09:34:20 +0200
Subject: [PATCH 2/2] kernel: Use NULL for pointers, not 0.

---
 sys/boot/efi/libefi/efinet.c         |  4 ++--
 sys/dev/disk/fd/fd.c                 | 20 ++++++++++----------
 sys/dev/misc/ppc/ppc.c               | 10 +++++-----
 sys/dev/netif/xe/if_xe.c             |  4 ++--
 sys/dev/sound/pci/als4000.c          |  4 ++--
 sys/vfs/isofs/cd9660/cd9660_vfsops.c |  2 +-
 sys/vfs/ufs/ffs_vfsops.c             |  2 +-
 7 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/sys/boot/efi/libefi/efinet.c b/sys/boot/efi/libefi/efinet.c
index 62b1fd80a4..0ad058e1bd 100644
--- a/sys/boot/efi/libefi/efinet.c
+++ b/sys/boot/efi/libefi/efinet.c
@@ -130,13 +130,13 @@ efinet_put(struct iodesc *desc, void *pkt, size_t len)
 
 	/* 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);
diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c
index 965f48e90d..92d2cad6a0 100644
--- a/sys/dev/disk/fd/fd.c
+++ b/sys/dev/disk/fd/fd.c
@@ -544,7 +544,7 @@ fdc_alloc_resources(struct fdc_data *fdc)
 					     &fdc->rid_ioport, 0ul, ~0ul, 
 					     ispcmcia ? 8 : (ispnp ? 1 : 6),
 					     RF_ACTIVE);
-	if (fdc->res_ioport == 0) {
+	if (fdc->res_ioport == NULL) {
 		device_printf(dev, "cannot reserve I/O port range\n");
 		return ENXIO;
 	}
@@ -592,7 +592,7 @@ fdc_alloc_resources(struct fdc_data *fdc)
 		fdc->res_ctl = bus_alloc_resource(dev, SYS_RES_IOPORT,
 						  &fdc->rid_ctl,
 						  0ul, ~0ul, 1, RF_ACTIVE);
-		if (fdc->res_ctl == 0) {
+		if (fdc->res_ctl == NULL) {
 			device_printf(dev,
 				      "cannot reserve control I/O port range\n");
 			return ENXIO;
@@ -604,7 +604,7 @@ fdc_alloc_resources(struct fdc_data *fdc)
 	fdc->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ,
 					  &fdc->rid_irq, 0ul, ~0ul, 1, 
 					  RF_ACTIVE);
-	if (fdc->res_irq == 0) {
+	if (fdc->res_irq == NULL) {
 		device_printf(dev, "cannot reserve interrupt line\n");
 		return ENXIO;
 	}
@@ -613,7 +613,7 @@ fdc_alloc_resources(struct fdc_data *fdc)
 		fdc->res_drq = bus_alloc_resource(dev, SYS_RES_DRQ,
 						  &fdc->rid_drq, 0ul, ~0ul, 1, 
 						  RF_ACTIVE);
-		if (fdc->res_drq == 0) {
+		if (fdc->res_drq == NULL) {
 			device_printf(dev, "cannot reserve DMA request line\n");
 			return ENXIO;
 		}
@@ -629,25 +629,25 @@ fdc_release_resources(struct fdc_data *fdc)
 	device_t dev;
 
 	dev = fdc->fdc_dev;
-	if (fdc->res_irq != 0) {
+	if (fdc->res_irq != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_IRQ, fdc->rid_irq,
 					fdc->res_irq);
 		bus_release_resource(dev, SYS_RES_IRQ, fdc->rid_irq,
 				     fdc->res_irq);
 	}
-	if (fdc->res_ctl != 0) {
+	if (fdc->res_ctl != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_IOPORT, fdc->rid_ctl,
 					fdc->res_ctl);
 		bus_release_resource(dev, SYS_RES_IOPORT, fdc->rid_ctl,
 				     fdc->res_ctl);
 	}
-	if (fdc->res_ioport != 0) {
+	if (fdc->res_ioport != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_IOPORT, fdc->rid_ioport,
 					fdc->res_ioport);
 		bus_release_resource(dev, SYS_RES_IOPORT, fdc->rid_ioport,
 				     fdc->res_ioport);
 	}
-	if (fdc->res_drq != 0) {
+	if (fdc->res_drq != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_DRQ, fdc->rid_drq,
 					fdc->res_drq);
 		bus_release_resource(dev, SYS_RES_DRQ, fdc->rid_drq,
@@ -1316,7 +1316,7 @@ Fdopen(struct dev_open_args *ap)
 	fdc_p	fdc;
 
 	/* check bounds */
-	if ((fd = devclass_get_softc(fd_devclass, fdu)) == 0)
+	if ((fd = devclass_get_softc(fd_devclass, fdu)) == NULL)
 		return (ENXIO);
 	fdc = fd->fdc;
 	if ((fdc == NULL) || (fd->type == NO_TYPE))
@@ -1471,7 +1471,7 @@ fdstrategy(struct dev_strategy_args *ap)
 
  	fdu = dkunit(dev);
 	fd = devclass_get_softc(fd_devclass, fdu);
-	if (fd == 0)
+	if (fd == NULL)
 		panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)",
 		      (u_long)major(dev), (u_long)minor(dev));
 	fdc = fd->fdc;
diff --git a/sys/dev/misc/ppc/ppc.c b/sys/dev/misc/ppc/ppc.c
index 30dadddcdd..0a113dcde5 100644
--- a/sys/dev/misc/ppc/ppc.c
+++ b/sys/dev/misc/ppc/ppc.c
@@ -1884,7 +1884,7 @@ ppc_probe(device_t dev)
 					     &ppc->rid_ioport, 0, ~0,
 					     IO_LPTSIZE_EXTENDED, RF_ACTIVE);
 
-	if (ppc->res_ioport != 0) {
+	if (ppc->res_ioport != NULL) {
 		if (bootverbose)
 			device_printf(dev, "using extended I/O port range\n");
 	} else {
@@ -1893,7 +1893,7 @@ ppc_probe(device_t dev)
 						      &ppc->rid_ioport, 0, ~0,
 						      IO_LPTSIZE_NORMAL,
 						      RF_ACTIVE);
-		if (ppc->res_ioport != 0) {
+		if (ppc->res_ioport != NULL) {
 			if (bootverbose)
 				device_printf(dev, "using normal I/O port range\n");
 		} else {
@@ -1938,17 +1938,17 @@ ppc_probe(device_t dev)
 	return (0);
 
 error:
-	if (ppc->res_irq != 0) {
+	if (ppc->res_irq != NULL) {
 		bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq,
 				     ppc->res_irq);
 	}
-	if (ppc->res_ioport != 0) {
+	if (ppc->res_ioport != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport,
 					ppc->res_ioport);
 		bus_release_resource(dev, SYS_RES_IOPORT, ppc->rid_ioport,
 				     ppc->res_ioport);
 	}
-	if (ppc->res_drq != 0) {
+	if (ppc->res_drq != NULL) {
 		bus_deactivate_resource(dev, SYS_RES_DRQ, ppc->rid_drq,
 					ppc->res_drq);
 		bus_release_resource(dev, SYS_RES_DRQ, ppc->rid_drq,
diff --git a/sys/dev/netif/xe/if_xe.c b/sys/dev/netif/xe/if_xe.c
index a2a4e9c916..08b67cf0e2 100644
--- a/sys/dev/netif/xe/if_xe.c
+++ b/sys/dev/netif/xe/if_xe.c
@@ -1923,7 +1923,7 @@ xe_activate(device_t dev)
 			sc->port_res = bus_alloc_resource(dev,
 			    SYS_RES_IOPORT, &sc->port_rid, start, 0x3ff, 16,
 			    RF_ACTIVE);
-			if (sc->port_res == 0)
+			if (sc->port_res == NULL)
 				break;		/* we failed */
 			if ((rman_get_start(sc->port_res) & 0xf) == 0)
 				break;		/* good */
@@ -1961,7 +1961,7 @@ xe_activate(device_t dev)
 		sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT,
 						  &sc->port_rid, start,
 						  start + 18, 18, RF_ACTIVE);
-		if (sc->port_res == 0)
+		if (sc->port_res == NULL)
 		    continue;	/* Failed, try again if possible */
 		if (bus_get_resource_start(dev, SYS_RES_IOPORT,
 					   sc->port_rid) == start)
diff --git a/sys/dev/sound/pci/als4000.c b/sys/dev/sound/pci/als4000.c
index af638a6d4a..d883242164 100644
--- a/sys/dev/sound/pci/als4000.c
+++ b/sys/dev/sound/pci/als4000.c
@@ -766,7 +766,7 @@ als_resource_grab(device_t dev, struct sc_info *sc)
 	sc->regid = PCIR_BAR(0);
 	sc->reg = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->regid, 0, ~0,
 				     ALS_CONFIG_SPACE_BYTES, RF_ACTIVE);
-	if (sc->reg == 0) {
+	if (sc->reg == NULL) {
 		device_printf(dev, "unable to allocate register space\n");
 		goto bad;
 	}
@@ -775,7 +775,7 @@ als_resource_grab(device_t dev, struct sc_info *sc)
 
 	sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid,
 					 RF_ACTIVE | RF_SHAREABLE);
-	if (sc->irq == 0) {
+	if (sc->irq == NULL) {
 		device_printf(dev, "unable to allocate interrupt\n");
 		goto bad;
 	}
diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c
index 4c738be64d..e8ab55cfcc 100644
--- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c
@@ -205,7 +205,7 @@ cd9660_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
 	 */
 	if (mp->mnt_flag & MNT_UPDATE) {
 		imp = VFSTOISOFS(mp);
-		if (args.fspec == 0)
+		if (args.fspec == NULL)
 			return (vfs_export(mp, &imp->im_export, &args.export));
 	}
 	/*
diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c
index a610d660cd..fd10d02865 100644
--- a/sys/vfs/ufs/ffs_vfsops.c
+++ b/sys/vfs/ufs/ffs_vfsops.c
@@ -264,7 +264,7 @@ ffs_mount(struct mount *mp,		/* mount struct pointer */
 			mp->mnt_flag &= ~MNT_ASYNC;
 		}
 		/* if not updating name...*/
-		if (args.fspec == 0) {
+		if (args.fspec == NULL) {
 			/*
 			 * Process export requests.  Jumping to "success"
 			 * will return the vfs_export() error code.
-- 
2.21.0

