vdpa: handle irq bypass register failure case
Subsystems (4)
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
@@ -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
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 ofirq_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.
Signed-off-by Zhu Lingshan <[email protected]>Reported-by kernel test robot <[email protected]>--- drivers/vhost/vdpa.c | 3 +++ 1 file changed, 3 insertions(+)drivers/vhost/vdpa.c +0
-0
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); }