xen/vpci: address violations of MISRA C:2012 Rule 7.2

The xen sources contains violations of MISRA C:2012 Rule 7.2 whose
headline states:
"A 'u' or 'U' suffix shall be applied to all integer constants
that are represented in an unsigned type".

Add the 'U' suffix to integers literals with unsigned type and also to other
literals used in the same contexts or near violations, when their positive
nature is immediately clear. The latter changes are done for the sake of
uniformity.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Gianluca Luparini authored and Jan Beulich committed 2023-08-28 15:27:51 +02:00
1 parent 5d84f07fe6
commit 067f18c3a7
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -124,7 +124,7 @@ static void cf_check address_hi_write(
struct vpci_msi *msi = data;
/* Clear and update high part. */
msi->address &= 0xffffffff;
msi->address = (uint32_t)msi->address;
msi->address |= (uint64_t)val << 32;
update_msi(pdev, msi);
+1 -1
View File
@@ -531,7 +531,7 @@ static int cf_check msix_write(
case PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET:
entry->updated = true;
entry->addr &= 0xffffffff;
entry->addr = (uint32_t)entry->addr;
entry->addr |= (uint64_t)data << 32;
break;
+3 -3
View File
@@ -319,7 +319,7 @@ static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
static uint32_t merge_result(uint32_t data, uint32_t new, unsigned int size,
unsigned int offset)
{
uint32_t mask = 0xffffffff >> (32 - 8 * size);
uint32_t mask = 0xffffffffU >> (32 - 8 * size);
return (data & ~(mask << (offset * 8))) | ((new & mask) << (offset * 8));
}
@@ -402,7 +402,7 @@ uint32_t vpci_read(pci_sbdf_t sbdf, unsigned int reg, unsigned int size)
data = merge_result(data, tmp_data, size - data_offset, data_offset);
}
return data & (0xffffffff >> (32 - 8 * size));
return data & (0xffffffffU >> (32 - 8 * size));
}
/*
@@ -427,7 +427,7 @@ static void vpci_write_helper(const struct pci_dev *pdev,
data = merge_result(val, data, size, offset);
}
r->write(pdev, r->offset, data & (0xffffffff >> (32 - 8 * r->size)),
r->write(pdev, r->offset, data & (0xffffffffU >> (32 - 8 * r->size)),
r->private);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.