diff mbox series

HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors

Message ID 20240429085422.2434036-1-nichen@iscas.ac.cn (mailing list archive)
State New
Delegated to: Jiri Kosina
Headers show
Series HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors | expand

Commit Message

Chen Ni April 29, 2024, 8:54 a.m. UTC
Add check for the return value of pci_alloc_irq_vectors() and return
the error if it fails in order to catch the error.

Fixes: 74fbc7d371d9 ("HID: intel-ish-hid: add MSI interrupt support")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

srinivas pandruvada May 2, 2024, 3:23 p.m. UTC | #1
On Mon, 2024-04-29 at 16:54 +0800, Chen Ni wrote:
> Add check for the return value of pci_alloc_irq_vectors() and return
> the error if it fails in order to catch the error.
> 
You can write as
"
Add a check for the return value of pci_alloc_irq_vectors() and return
error if it fails.
"

Thanks,
Srinivas

> Fixes: 74fbc7d371d9 ("HID: intel-ish-hid: add MSI interrupt support")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>  drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> index e79d72f7db2a..9b9bc58f0524 100644
> --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> @@ -174,6 +174,11 @@ static int ish_probe(struct pci_dev *pdev, const
> struct pci_device_id *ent)
>  
>         /* request and enable interrupt */
>         ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> +       if (ret < 0) {
> +               dev_err(dev, "ISH: Failed to allocate IRQ
> vectors\n");
> +               return ret;
> +       }
> +
>         if (!pdev->msi_enabled && !pdev->msix_enabled)
>                 irq_flag = IRQF_SHARED;
>
Jiri Kosina May 6, 2024, 9:11 p.m. UTC | #2
On Thu, 2 May 2024, srinivas pandruvada wrote:

> On Mon, 2024-04-29 at 16:54 +0800, Chen Ni wrote:
> > Add check for the return value of pci_alloc_irq_vectors() and return
> > the error if it fails in order to catch the error.
> > 
> You can write as
> "
> Add a check for the return value of pci_alloc_irq_vectors() and return
> error if it fails.
> "

Srinivas,

my understanding is that with the changelog rewroding this patch has your 
Ack?

Thanks,
srinivas pandruvada May 6, 2024, 9:52 p.m. UTC | #3
On Mon, 2024-05-06 at 23:11 +0200, Jiri Kosina wrote:
> On Thu, 2 May 2024, srinivas pandruvada wrote:
> 
> > On Mon, 2024-04-29 at 16:54 +0800, Chen Ni wrote:
> > > Add check for the return value of pci_alloc_irq_vectors() and
> > > return
> > > the error if it fails in order to catch the error.
> > > 
> > You can write as
> > "
> > Add a check for the return value of pci_alloc_irq_vectors() and
> > return
> > error if it fails.
> > "
> 
Hi Jiri,

> Srinivas,
> 
> my understanding is that with the changelog rewroding this patch has
> your 
> Ack?
Yes, just to make it more clear. With that.


Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Thanks,
Srinivas


> 
> Thanks,
>
Jiri Kosina May 6, 2024, 9:55 p.m. UTC | #4
On Mon, 6 May 2024, srinivas pandruvada wrote:

> > my understanding is that with the changelog rewroding this patch has
> > your 
> > Ack?
> Yes, just to make it more clear. With that.
> 
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Thanks, now applied.
diff mbox series

Patch

diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index e79d72f7db2a..9b9bc58f0524 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -174,6 +174,11 @@  static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	/* request and enable interrupt */
 	ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+	if (ret < 0) {
+		dev_err(dev, "ISH: Failed to allocate IRQ vectors\n");
+		return ret;
+	}
+
 	if (!pdev->msi_enabled && !pdev->msix_enabled)
 		irq_flag = IRQF_SHARED;