struct list_head *insert = &aac_devices;
        int error = -ENODEV;
        int unique_id = 0;
+       u64 dmamask;
 
        list_for_each_entry(aac, &aac_devices, entry) {
                if (aac->id > unique_id)
                goto out;
        error = -ENODEV;
 
-       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) ||
-                       pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))
-               goto out_disable_pdev;
        /*
         * If the quirk31 bit is set, the adapter needs adapter
         * to driver communication memory to be allocated below 2gig
         */
        if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
-               if (pci_set_dma_mask(pdev, DMA_BIT_MASK(31)) ||
-                               pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(31)))
-                       goto out_disable_pdev;
+               dmamask = DMA_BIT_MASK(31);
+       else
+               dmamask = DMA_BIT_MASK(32);
+
+       if (pci_set_dma_mask(pdev, dmamask) ||
+                       pci_set_consistent_dma_mask(pdev, dmamask))
+               goto out_disable_pdev;
 
        pci_set_master(pdev);