diff options
author | jhb <jhb@FreeBSD.org> | 2010-12-16 17:05:28 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-12-16 17:05:28 +0000 |
commit | f6949632bc7e62eab7d9a0668540a8cd6eafb45f (patch) | |
tree | b46f4beeb3dac7b6ba9d4f90c87ff7fd3103906b /sys/x86/isa | |
parent | c65c4f33f57d89072950dae0a54f2bac154c1cfa (diff) | |
download | FreeBSD-src-f6949632bc7e62eab7d9a0668540a8cd6eafb45f.zip FreeBSD-src-f6949632bc7e62eab7d9a0668540a8cd6eafb45f.tar.gz |
Small style fixes:
- Avoid side-effect assignments in if statements when possible.
- Don't use ! to check for NULL pointers, explicitly check against NULL.
- Explicitly check error return values against 0.
- Don't use INTR_MPSAFE for interrupt handlers with only filters as it is
meaningless.
- Remove unneeded function casts.
Diffstat (limited to 'sys/x86/isa')
-rw-r--r-- | sys/x86/isa/atrtc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/x86/isa/atrtc.c b/sys/x86/isa/atrtc.c index cb24fcc..2980098 100644 --- a/sys/x86/isa/atrtc.c +++ b/sys/x86/isa/atrtc.c @@ -245,9 +245,10 @@ atrtc_attach(device_t dev) int i; sc = device_get_softc(dev); - if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid, IO_RTC, IO_RTC + 1, 2, RF_ACTIVE))) - device_printf(dev,"Warning: Couldn't map I/O.\n"); + sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, + IO_RTC, IO_RTC + 1, 2, RF_ACTIVE); + if (sc->port_res == NULL) + device_printf(dev, "Warning: Couldn't map I/O.\n"); atrtc_start(); clock_register(dev, 1000000); bzero(&sc->et, sizeof(struct eventtimer)); @@ -258,14 +259,13 @@ atrtc_attach(device_t dev) while (bus_get_resource(dev, SYS_RES_IRQ, sc->intr_rid, &s, NULL) == 0 && s != 8) sc->intr_rid++; - if (!(sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, - &sc->intr_rid, 8, 8, 1, RF_ACTIVE))) { - device_printf(dev,"Can't map interrupt.\n"); + sc->intr_res = bus_alloc_resource(dev, SYS_RES_IRQ, + &sc->intr_rid, 8, 8, 1, RF_ACTIVE); + if (sc->intr_res == NULL) { + device_printf(dev, "Can't map interrupt.\n"); return (0); - } else if ((bus_setup_intr(dev, sc->intr_res, - INTR_MPSAFE | INTR_TYPE_CLK, - (driver_filter_t *)rtc_intr, NULL, - sc, &sc->intr_handler))) { + } else if ((bus_setup_intr(dev, sc->intr_res, INTR_TYPE_CLK, + rtc_intr, NULL, sc, &sc->intr_handler))) { device_printf(dev, "Can't setup interrupt.\n"); return (0); } else { |