diff options
author | Alexandru Elisei <alexandru.elisei@arm.com> | 2021-10-12 14:25:04 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-10-13 08:36:59 +0100 |
commit | e3b0ade2de2b1d38630d51600d5e6eb859f5dc89 (patch) | |
tree | eadaf517e9206654632d78d04dff3a3845c29137 | |
parent | dc6646192057e63084ef8dd76eb1e2bff5398aa8 (diff) | |
download | kvmtool-e3b0ade2de2b1d38630d51600d5e6eb859f5dc89.tar.gz |
arm/gicv2m: Set errno when gicv2_update_routing() fails
In case of an error when updating the routing table entries,
irq__update_msix_route() uses perror to print an error message.
gicv2m_update_routing() doesn't set errno, and instead returns the value
that errno should have had, which can lead to failure messages like this:
KVM_SET_GSI_ROUTING: Success
Set errno in gicv2m_update_routing() to avoid such messages in the future.
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20211012132510.42134-2-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | arm/gicv2m.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arm/gicv2m.c b/arm/gicv2m.c index d7e6398a..b47ada80 100644 --- a/arm/gicv2m.c +++ b/arm/gicv2m.c @@ -42,16 +42,18 @@ static int gicv2m_update_routing(struct kvm *kvm, { int spi; - if (entry->type != KVM_IRQ_ROUTING_MSI) - return -EINVAL; + if (entry->type != KVM_IRQ_ROUTING_MSI) { + errno = EINVAL; + return -errno; + } if (!entry->u.msi.address_hi && !entry->u.msi.address_lo) return 0; spi = entry->u.msi.data & GICV2M_SPI_MASK; if (spi < v2m.first_spi || spi >= v2m.first_spi + v2m.num_spis) { - pr_err("invalid SPI number %d", spi); - return -EINVAL; + errno = EINVAL; + return -errno; } v2m.spis[spi - v2m.first_spi] = entry->gsi; |