aboutsummaryrefslogtreecommitdiff
path: root/hw/pci
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-02-16 21:03:40 +0300
committerMichael S. Tsirkin <mst@redhat.com>2023-03-02 03:10:48 -0500
commit94c84780cebc3b3107c85c71e3ae4467b51b3bbe (patch)
treed5c6c9f049d3faf6ba217455ccc91f87dd0a9adf /hw/pci
parent93af1274ea6220ef5eae6058b2fe74ae2c8b842b (diff)
downloadqemu-94c84780cebc3b3107c85c71e3ae4467b51b3bbe.zip
qemu-94c84780cebc3b3107c85c71e3ae4467b51b3bbe.tar.gz
qemu-94c84780cebc3b3107c85c71e3ae4467b51b3bbe.tar.bz2
pci/shpc: change shpc_get_status() return type to uint8_t
The result of the function is always one byte. The result is always assigned to uint8_t variable. Also, shpc_get_status() should be symmetric to shpc_set_status() which has uint8_t value argument. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Anton Kuchin <antonkuchin@yandex-team.ru> Message-Id: <20230216180356.156832-3-vsementsov@yandex-team.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/pci')
-rw-r--r--hw/pci/shpc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c
index 1b3f619..5d71569 100644
--- a/hw/pci/shpc.c
+++ b/hw/pci/shpc.c
@@ -123,10 +123,13 @@
#define SHPC_PCI_TO_IDX(pci_slot) ((pci_slot) - 1)
#define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1)
-static uint16_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk)
+static uint8_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk)
{
uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot);
- return (pci_get_word(status) & msk) >> ctz32(msk);
+ uint16_t result = (pci_get_word(status) & msk) >> ctz32(msk);
+
+ assert(result <= UINT8_MAX);
+ return result;
}
static void shpc_set_status(SHPCDevice *shpc,