kern: Fix [-Werror=aggressive-loop-optimizations]
authorJohn Marino <draco@marino.st>
Wed, 11 Feb 2015 01:57:59 +0000 (02:57 +0100)
committerJohn Marino <draco@marino.st>
Wed, 11 Feb 2015 01:57:59 +0000 (02:57 +0100)
These were basic upper bound checking errors on loops

sys/bus/pccard/pccard.c
sys/dev/raid/arcmsr/arcmsr.c

index c4d4e5b..e786539 100644 (file)
@@ -971,7 +971,7 @@ pccard_probe_nomatch(device_t bus, device_t child)
            "at function %d\n", sc->card.manufacturer, sc->card.product,
            pf->function, pf->number);
        device_printf(bus, "   CIS info: ");
-       for (i = 0; sc->card.cis1_info[i] != NULL && i < 4; i++)
+       for (i = 0; i < 4 && sc->card.cis1_info[i] != NULL; i++)
                kprintf("%s%s", i > 0 ? ", " : "", sc->card.cis1_info[i]);
        kprintf("\n");
        return;
index d9bfb7f..282c06e 100644 (file)
@@ -4381,7 +4381,7 @@ static int arcmsr_detach(device_t dev)
        bus_teardown_intr(dev, acb->irqres, acb->ih);
        arcmsr_shutdown(dev);
        arcmsr_free_resource(acb);
-       for(i=0; (acb->sys_res_arcmsr[i]!=NULL) && (i<2); i++) {
+       for(i=0; i<2 && (acb->sys_res_arcmsr[i]!=NULL); i++) {
                bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(i), acb->sys_res_arcmsr[i]);
        }
        bus_release_resource(dev, SYS_RES_IRQ, 0, acb->irqres);