Ihor Matushchak
2019-Jul-02 14:49 UTC
[PATCH v2] virtio-mmio: add error check for platform_get_irq
in vm_find_vqs() irq has a wrong type so, in case of no IRQ resource defined, wrong parameter will be passed to request_irq() Signed-off-by: Ihor Matushchak <ihor.matushchak at foobox.net> --- Changes in v2: Don't overwrite error code value. drivers/virtio/virtio_mmio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index f363fbeb5ab0..e09edb5c5e06 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -463,9 +463,14 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, struct irq_affinity *desc) { struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); - unsigned int irq = platform_get_irq(vm_dev->pdev, 0); + int irq = platform_get_irq(vm_dev->pdev, 0); int i, err, queue_idx = 0; + if (irq < 0) { + dev_err(&vdev->dev, "Cannot get IRQ resource\n"); + return irq; + } + err = request_irq(irq, vm_interrupt, IRQF_SHARED, dev_name(&vdev->dev), vm_dev); if (err) -- 2.17.1
Ivan T. Ivanov
2019-Jul-02 18:19 UTC
[PATCH v2] virtio-mmio: add error check for platform_get_irq
Quoting Ihor Matushchak (2019-07-02 17:48:18)> in vm_find_vqs() irq has a wrong type > so, in case of no IRQ resource defined, > wrong parameter will be passed to request_irq() > > Signed-off-by: Ihor Matushchak <ihor.matushchak at foobox.net>Reviewed-by: Ivan T. Ivanov <iivanov.xz at gmail.com> Thanks!> --- > Changes in v2: > Don't overwrite error code value. > > drivers/virtio/virtio_mmio.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index f363fbeb5ab0..e09edb5c5e06 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -463,9 +463,14 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, > struct irq_affinity *desc) > { > struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); > - unsigned int irq = platform_get_irq(vm_dev->pdev, 0); > + int irq = platform_get_irq(vm_dev->pdev, 0); > int i, err, queue_idx = 0; > > + if (irq < 0) { > + dev_err(&vdev->dev, "Cannot get IRQ resource\n"); > + return irq; > + } > + > err = request_irq(irq, vm_interrupt, IRQF_SHARED, > dev_name(&vdev->dev), vm_dev); > if (err) > -- > 2.17.1 >
Michael S. Tsirkin
2019-Jul-02 18:23 UTC
[PATCH v2] virtio-mmio: add error check for platform_get_irq
On Tue, Jul 02, 2019 at 05:48:18PM +0300, Ihor Matushchak wrote:> in vm_find_vqs() irq has a wrong type > so, in case of no IRQ resource defined, > wrong parameter will be passed to request_irq() > > Signed-off-by: Ihor Matushchak <ihor.matushchak at foobox.net>Thanks! pls don't make v2 a response to v1 in the future though.> --- > Changes in v2: > Don't overwrite error code value. > > drivers/virtio/virtio_mmio.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index f363fbeb5ab0..e09edb5c5e06 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -463,9 +463,14 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, > struct irq_affinity *desc) > { > struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); > - unsigned int irq = platform_get_irq(vm_dev->pdev, 0); > + int irq = platform_get_irq(vm_dev->pdev, 0); > int i, err, queue_idx = 0; > > + if (irq < 0) { > + dev_err(&vdev->dev, "Cannot get IRQ resource\n"); > + return irq; > + } > + > err = request_irq(irq, vm_interrupt, IRQF_SHARED, > dev_name(&vdev->dev), vm_dev); > if (err) > -- > 2.17.1
Maybe Matching Threads
- [PATCH v2] virtio-mmio: add error check for platform_get_irq
- [PATCH v2] virtio-mmio: add error check for platform_get_irq
- [PATCH AUTOSEL 5.2 36/85] virtio-mmio: add error check for platform_get_irq
- [PATCH] virtio-mmio: add error check for platform_get_irq
- [PATCH] virtio-mmio: add error check for platform_get_irq