hv: irq: fix type for vector in ioapic setup

Fix the type for vector in ioapic setup, which is a potential problem:
- return VECTOR_INVALID instead of false in irq_desc_alloc_vector()
  when irq is out of range;
- change variable type from int to uint32_t for vector, and correct
  the returned value check.

Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yan, Like 2018-06-25 16:42:08 +08:00 committed by Xie, Nanlin
parent bab8fadfee
commit 5b14df3a35
2 changed files with 3 additions and 3 deletions

View File

@ -304,7 +304,7 @@ void setup_ioapic_irq(void)
{
int ioapic_id;
uint32_t gsi;
int vr;
uint32_t vr;
spinlock_init(&ioapic_lock);
@ -343,7 +343,7 @@ void setup_ioapic_irq(void)
*/
if (gsi < NR_LEGACY_IRQ) {
vr = irq_desc_alloc_vector(gsi, false);
if (vr < 0) {
if (vr > NR_MAX_VECTOR) {
pr_err("failed to alloc VR");
gsi++;
continue;

View File

@ -327,7 +327,7 @@ uint32_t irq_desc_alloc_vector(uint32_t irq, bool lowpri)
/* irq should be always available at this time */
if (irq > NR_MAX_IRQS)
return false;
return VECTOR_INVALID;
desc = irq_desc_base + irq;
spinlock_irqsave_obtain(&desc->irq_lock);