kernel: Use NULL for pointers, not 0.
authorSascha Wildner <saw@online.de>
Thu, 18 Apr 2019 07:34:20 +0000 (09:34 +0200)
committerSascha Wildner <saw@online.de>
Thu, 18 Apr 2019 07:34:20 +0000 (09:34 +0200)
sys/boot/efi/libefi/efinet.c
sys/dev/disk/fd/fd.c
sys/dev/misc/ppc/ppc.c
sys/dev/netif/xe/if_xe.c
sys/dev/sound/pci/als4000.c
sys/vfs/isofs/cd9660/cd9660_vfsops.c
sys/vfs/ufs/ffs_vfsops.c

index 62b1fd8..0ad058e 100644 (file)
@@ -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);
index 965f48e..92d2cad 100644 (file)
@@ -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;
index 30daddd..0a113dc 100644 (file)
@@ -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,
index a2a4e9c..08b67cf 100644 (file)
@@ -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)
index af638a6..d883242 100644 (file)
@@ -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;
        }
index 4c738be..e8ab55c 100644 (file)
@@ -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));
        }
        /*
index a610d66..fd10d02 100644 (file)
@@ -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.