aic79xx leaves timers inserted when ahd_init() (which inserts
two timers at its very end) succeeds but ahd_pci_map_int()
fails. In this case ahd->init_level gets incremented to 5 only
when that function succeeds, but ahd_free() calls ahd_shutdown()
only when ahd->init_level == 5, and ahd_shutdown() is where the
timers get removed. Since the freeing of the IRQ is not controlled
by ahd->init_level, we should increment init_level prior to
calling ahd_pci_map_int().
Reported-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
        error = ahd_init(ahd);
        if (error != 0)
                return (error);
+       ahd->init_level++;
 
        /*
         * Allow interrupts now that we are completely setup.
         */
-       error = ahd_pci_map_int(ahd);
-       if (!error)
-               ahd->init_level++;
-       return error;
+       return ahd_pci_map_int(ahd);
 }
 
 #ifdef CONFIG_PM
 
        error = ahc_init(ahc);
        if (error != 0)
                return (error);
+       ahc->init_level++;
 
        /*
         * Allow interrupts now that we are completely setup.
         */
-       error = ahc_pci_map_int(ahc);
-       if (error != 0)
-               return (error);
-
-       ahc->init_level++;
-       return (0);
+       return ahc_pci_map_int(ahc);
 }
 
 /*