Skip to contentSkip to conversation

fix use of multi_msi_capable()

PATCH New Jan Beulich 1 participant 1 message Nov 11, 2008 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 fix use of multi_msi_capable()

Also, isn't the single use of multi_msi_capable() broken (in the event that the Multiple Message Capable field was 5, the shift would be undefined, on x86 in particular would yield 1 as the result, where 0 would be needed), and the subsequent twiddling of temp needlessly complicated (subtracting one should be sufficient here).

---
 drivers/pci/msi.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pci/msi.c +2 -3
@@ -389,9 +389,8 @@ static int msi_capability_init(struct pc
 		pci_read_config_dword(dev,
 			msi_mask_bits_reg(pos, entry->msi_attrib.is_64),
 			&maskbits);
-		temp = (1 << multi_msi_capable(control));
-		temp = ((temp - 1) & ~temp);
-		maskbits |= temp;
+		temp = 1U << (multi_msi_capable(control) - 1);
+		maskbits |= (temp << 1) - 1;
 		pci_write_config_dword(dev, entry->msi_attrib.is_64, maskbits);
 		entry->msi_attrib.maskbits_mask = temp;
 	}