aboutsummaryrefslogtreecommitdiff
path: root/hw/pci/msix.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-22 13:04:16 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-31 12:29:07 +0200
commit0ef1efcf944fcc950840f068da5513311ee55a6d (patch)
tree47720c33f6aeef06ec2f3d06103e1df937a5b588 /hw/pci/msix.c
parent54ac85ef0d5c76503548cec29e4e0b556e3cf00b (diff)
downloadqemu-0ef1efcf944fcc950840f068da5513311ee55a6d.zip
qemu-0ef1efcf944fcc950840f068da5513311ee55a6d.tar.gz
qemu-0ef1efcf944fcc950840f068da5513311ee55a6d.tar.bz2
msix: use DIV_ROUND_UP
I used the clang-tidy qemu-round check to generate the fix: https://github.com/elmarco/clang-tools-extra Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'hw/pci/msix.c')
-rw-r--r--hw/pci/msix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index 5078d3d..c944c02 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -438,7 +438,7 @@ void msix_save(PCIDevice *dev, QEMUFile *f)
}
qemu_put_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
- qemu_put_buffer(f, dev->msix_pba, (n + 7) / 8);
+ qemu_put_buffer(f, dev->msix_pba, DIV_ROUND_UP(n, 8));
}
/* Should be called after restoring the config space. */
@@ -453,7 +453,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f)
msix_clear_all_vectors(dev);
qemu_get_buffer(f, dev->msix_table, n * PCI_MSIX_ENTRY_SIZE);
- qemu_get_buffer(f, dev->msix_pba, (n + 7) / 8);
+ qemu_get_buffer(f, dev->msix_pba, DIV_ROUND_UP(n, 8));
msix_update_function_masked(dev);
for (vector = 0; vector < n; vector++) {