diff mbox series

vdpa: handle irq bypass register failure case

Message ID 20201023104046.404794-1-lingshan.zhu@intel.com
State Not Applicable
Delegated to: David Miller
Headers show
Series vdpa: handle irq bypass register failure case | expand

Checks

Context Check Description
jkicinski/tree_selection success Not a local patch

Commit Message

Zhu, Lingshan Oct. 23, 2020, 10:40 a.m. UTC
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.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/vhost/vdpa.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jason Wang Oct. 26, 2020, 2:45 a.m. UTC | #1
On 2020/10/23 下午6:40, Zhu Lingshan wrote:
> 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.
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
>   drivers/vhost/vdpa.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 62a9bb0efc55..d6b2c3bd1b01 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -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);
>   }
>   


Acked-by: Jason Wang <jasowang@redhat.com>
diff mbox series

Patch

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 62a9bb0efc55..d6b2c3bd1b01 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -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);
 }