Skip to contentSkip to conversation

vdpa: handle irq bypass register failure case

PATCH In review Zhu Lingshan 2 participants 2 messages Oct 23, 2020 – Oct 26, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vdpa: handle irq bypass register failure case

LKP considered variable 'ret' in vhost_vdpa_setup_vq_irq() as a unused variable, so suggest we remove it. Actually it stores return value of irq_bypass_register_producer(), but we did not check it, we should handle the failure case.

This commit will print a message if irq bypass register producer fail, in this case, vqs still remain functional.

---
 drivers/vhost/vdpa.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/vhost/vdpa.c +3 -0
index 62a9bb0efc55..d6b2c3bd1b01 100644
@@ -107,6 +107,9 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
 	vq->call_ctx.producer.token = vq->call_ctx.ctx;
 	vq->call_ctx.producer.irq = irq;
 	ret = irq_bypass_register_producer(&vq->call_ctx.producer);
+	if (unlikely(ret))
+		dev_info(&v->dev, "vq %u, irq bypass producer (token %p) registration fails, ret =  %d\n",
+			 qid, vq->call_ctx.producer.token, ret);
 	spin_unlock(&vq->call_ctx.ctx_lock);
 }
 
Signature · 1 line
2.18.4
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Zhu Lingshan

LKP considered variable 'ret' in vhost_vdpa_setup_vq_irq() as a unused variable, so suggest we remove it. Actually it stores return value of irq_bypass_register_producer(), but we did not check it, we should handle the failure case.

This commit will print a message if irq bypass register producer fail, in this case, vqs still remain functional.

---
  drivers/vhost/vdpa.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/vhost/vdpa.c +0 -0
index 62a9bb0efc55..d6b2c3bd1b01 100644

drivers/vhost/vdpa.c static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid) · line 115

Quoted 9 lines
drivers/vhost/vdpa.c +3 -0
@@ -107,6 +107,9 @@ static void vhost_vdpa_setup_vq_irq(struct vhost_vdpa *v, u16 qid)
  	vq->call_ctx.producer.token = vq->call_ctx.ctx;
  	vq->call_ctx.producer.irq = irq;
  	ret = irq_bypass_register_producer(&vq->call_ctx.producer);
+	if (unlikely(ret))
+		dev_info(&v->dev, "vq %u, irq bypass producer (token %p) registration fails, ret =  %d\n",
+			 qid, vq->call_ctx.producer.token, ret);
  	spin_unlock(&vq->call_ctx.ctx_lock);
  }