All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure
@ 2026-07-16  7:51 Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 1/4] HID: amd_sfh: Remove redundant dev_err() Pan Chuang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-16  7:51 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	Srinivas Pandruvada, Even Xu, Xinpeng Sun, Zhang Lixu,
	Andy Shevchenko, Vineeth Pillai, Pan Chuang, Sakari Ailus,
	Abhishek Tamboli, Danny D.,
	open list:AMD SENSOR FUSION HUB DRIVER, open list

Commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()") added automatic error logging to
devm_request_threaded_irq() and devm_request_any_context_irq()
via the new devm_request_result() helper, which prints device
name, IRQ number, handler functions, and error code on failure.

Since devm_request_irq() is a static inline wrapper around
devm_request_threaded_irq(), it also benefits from this
automatic logging.

Remove the now-redundant dev_err() and dev_err_probe() calls
in hid drivers that follow these devm_request_*_irq()
functions, as the core now provides more detailed diagnostic
information on failure.

v1 -> v2:
- Added the same change for the intel-quicki2c driver

Pan Chuang (4):
  HID: amd_sfh: Remove redundant dev_err()
  HID: hid-goodix: Remove redundant dev_err()
  HID: intel-ish-hid: ipc: Remove redundant dev_err()
  HID: Intel-thc-hid: Remove redundant dev_err()

 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c                  | 5 +----
 drivers/hid/hid-goodix-spi.c                            | 5 +----
 drivers/hid/intel-ish-hid/ipc/pci-ish.c                 | 4 +---
 drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 5 +----
 drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 5 +----
 5 files changed, 5 insertions(+), 19 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] HID: amd_sfh: Remove redundant dev_err()
  2026-07-16  7:51 [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure Pan Chuang
@ 2026-07-16  7:51 ` Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 2/4] HID: hid-goodix: " Pan Chuang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-16  7:51 UTC (permalink / raw)
  To: Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires,
	open list:AMD SENSOR FUSION HUB DRIVER, open list
  Cc: Pan Chuang

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 4b81cebdc335..a2acd3ca20e2 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -128,11 +128,8 @@ int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
 
 	rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq,
 			      amd_sfh_irq_handler, 0, DRIVER_NAME, privdata);
-	if (rc) {
-		dev_err(&privdata->pdev->dev, "failed to request irq %d err=%d\n",
-			privdata->pdev->irq, rc);
+	if (rc)
 		return rc;
-	}
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] HID: hid-goodix: Remove redundant dev_err()
  2026-07-16  7:51 [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 1/4] HID: amd_sfh: Remove redundant dev_err() Pan Chuang
@ 2026-07-16  7:51 ` Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 3/4] HID: intel-ish-hid: ipc: " Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 4/4] HID: Intel-thc-hid: " Pan Chuang
  3 siblings, 0 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-16  7:51 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, open list:HID CORE LAYER,
	open list
  Cc: Pan Chuang

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/hid/hid-goodix-spi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c
index 288cb827e9d6..03d549efbdce 100644
--- a/drivers/hid/hid-goodix-spi.c
+++ b/drivers/hid/hid-goodix-spi.c
@@ -722,11 +722,8 @@ static int goodix_spi_probe(struct spi_device *spi)
 	error = devm_request_threaded_irq(&ts->spi->dev, ts->spi->irq,
 					  NULL, goodix_hid_irq, IRQF_ONESHOT,
 					  "goodix_spi_hid", ts);
-	if (error) {
-		dev_err(ts->dev, "could not register interrupt, irq = %d, %d",
-			ts->spi->irq, error);
+	if (error)
 		goto err_destroy_hid;
-	}
 
 	return 0;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] HID: intel-ish-hid: ipc: Remove redundant dev_err()
  2026-07-16  7:51 [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 1/4] HID: amd_sfh: Remove redundant dev_err() Pan Chuang
  2026-07-16  7:51 ` [PATCH v2 2/4] HID: hid-goodix: " Pan Chuang
@ 2026-07-16  7:51 ` Pan Chuang
  2026-07-16  8:17   ` sashiko-bot
  2026-07-16  7:51 ` [PATCH v2 4/4] HID: Intel-thc-hid: " Pan Chuang
  3 siblings, 1 reply; 7+ messages in thread
From: Pan Chuang @ 2026-07-16  7:51 UTC (permalink / raw)
  To: Srinivas Pandruvada, Jiri Kosina, Benjamin Tissoires, Zhang Lixu,
	Andy Shevchenko, Vineeth Pillai, Pan Chuang,
	open list:INTEL INTEGRATED SENSOR HUB DRIVER, open list

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
---
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 8d36ae96a3ee..e7196e429c8b 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -232,10 +232,8 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	ret = devm_request_irq(dev, pdev->irq, ish_irq_handler,
 			       irq_flag, KBUILD_MODNAME, ishtp);
-	if (ret) {
-		dev_err(dev, "ISH: request IRQ %d failed\n", pdev->irq);
+	if (ret)
 		return ret;
-	}
 
 	dev_set_drvdata(ishtp->devc, ishtp);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] HID: Intel-thc-hid: Remove redundant dev_err()
  2026-07-16  7:51 [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure Pan Chuang
                   ` (2 preceding siblings ...)
  2026-07-16  7:51 ` [PATCH v2 3/4] HID: intel-ish-hid: ipc: " Pan Chuang
@ 2026-07-16  7:51 ` Pan Chuang
  2026-07-16  8:33   ` sashiko-bot
  3 siblings, 1 reply; 7+ messages in thread
From: Pan Chuang @ 2026-07-16  7:51 UTC (permalink / raw)
  To: Even Xu, Xinpeng Sun, Jiri Kosina, Benjamin Tissoires,
	Sakari Ailus, Pan Chuang, Abhishek Tamboli, Danny D.,
	open list:HID CORE LAYER, open list

Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 5 +----
 drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
index 46d3e9a01999..59f500345acb 100644
--- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
+++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
@@ -682,11 +682,8 @@ static int quicki2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 					quicki2c_irq_thread_handler,
 					IRQF_ONESHOT, KBUILD_MODNAME,
 					qcdev);
-	if (ret) {
-		dev_err_once(&pdev->dev,
-			     "Failed to request threaded IRQ, irq = %d.\n", pdev->irq);
+	if (ret)
 		goto dev_deinit;
-	}
 
 	ret = quicki2c_get_device_descriptor(qcdev);
 	if (ret) {
diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
index 4ae2e1718b30..504ef3c842ab 100644
--- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
+++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
@@ -636,11 +636,8 @@ static int quickspi_probe(struct pci_dev *pdev,
 					quickspi_irq_thread_handler,
 					IRQF_ONESHOT, KBUILD_MODNAME,
 					qsdev);
-	if (ret) {
-		dev_err(&pdev->dev,
-			"Failed to request threaded IRQ, irq = %d.\n", pdev->irq);
+	if (ret)
 		goto dev_deinit;
-	}
 
 	ret = reset_tic(qsdev);
 	if (ret) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/4] HID: intel-ish-hid: ipc: Remove redundant dev_err()
  2026-07-16  7:51 ` [PATCH v2 3/4] HID: intel-ish-hid: ipc: " Pan Chuang
@ 2026-07-16  8:17   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-07-16  8:17 UTC (permalink / raw)
  To: Pan Chuang; +Cc: linux-input, dmitry.torokhov

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing call to `pci_free_irq_vectors()` in the error paths of `ish_probe()` after a successful `pci_alloc_irq_vectors()`.
--

--- Patch [3]: [PATCH v2 3/4] HID: intel-ish-hid: ipc: Remove redundant dev_err() ---
commit e6d17c39d85bf24754ef698f7e6d06f53c4283e2
Author: Pan Chuang <panchuang@vivo.com>

HID: intel-ish-hid: ipc: Remove redundant dev_err()
    
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

> diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> index ed3405c05e73c..cef1030643f15 100644
> --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> @@ -232,10 +232,8 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	ret = devm_request_irq(dev, pdev->irq, ish_irq_handler,
>  			       irq_flag, KBUILD_MODNAME, ishtp);
> -	if (ret) {
> -		dev_err(dev, "ISH: request IRQ %d failed\n", pdev->irq);
> +	if (ret)
>  		return ret;

[Severity: High]
This is a pre-existing issue, but does this error path leak the IRQ vectors
allocated earlier in ish_probe()?

If devm_request_irq() fails, the function returns directly. Similarly, if
ish_init() fails further down in ish_probe(), it also returns directly:

    ret = ish_init(ishtp);
    if (ret)
        return ret;

Should there be a call to pci_free_irq_vectors() in these error paths
since pci_alloc_irq_vectors() was successfully called previously?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260716075203.593012-1-panchuang@vivo.com?part=3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] HID: Intel-thc-hid: Remove redundant dev_err()
  2026-07-16  7:51 ` [PATCH v2 4/4] HID: Intel-thc-hid: " Pan Chuang
@ 2026-07-16  8:33   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-07-16  8:33 UTC (permalink / raw)
  To: Pan Chuang; +Cc: dmitry.torokhov, linux-input

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Device removal manually frees non-devm DMA scatterlist buffers before disabling hardware interrupts and the threaded IRQ handler, leading to a Use-After-Free.
- [High] The primary interrupt handlers unconditionally return `IRQ_HANDLED` when the device is in the `DISABLED` state, without checking the hardware interrupt source or clearing the interrupt condition.
--

--- Patch [4]: [PATCH v2 4/4] HID: Intel-thc-hid: Remove redundant dev_err() ---
commit d99357f50f34b4097b4c3b9ec6cfab0677cc831e
Author: Pan Chuang <panchuang@vivo.com>
Subject: HID: Intel-thc-hid: Remove redundant dev_err()

This commit removes redundant driver-specific dev_err calls following
devm_request_threaded_irq failures, as detailed error messages are already
logged by the core subsystem on failure.

> diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
> index 46d3e9a019995..59f500345acbf 100644
> --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
> +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
> @@ -682,11 +682,8 @@ static int quicki2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  					quicki2c_irq_thread_handler,
>  					IRQF_ONESHOT, KBUILD_MODNAME,
>  					qcdev);

[Severity: High]
This is a pre-existing issue, but while we are touching the threaded IRQ
setup, does quicki2c_irq_quick_handler() properly handle shared INTx
interrupts?

drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c:quicki2c_irq_quick_handler() {
    ...
    if (qcdev->state == QUICKI2C_DISABLED)
        return IRQ_HANDLED;
    ...
}

The device initializes with PCI_IRQ_ALL_TYPES, allowing fallback to INTx.
If an interrupt fires when the device state is QUICKI2C_DISABLED, the
handler unconditionally returns IRQ_HANDLED without clearing the hardware
condition. Could this prevent the generic IRQ subsystem from detecting and
disabling spurious interrupts, resulting in an interrupt storm?

[Severity: Critical]
This is a pre-existing issue, but does relying on a devm-managed IRQ here
cause a use-after-free regression during driver unbind?

During driver unbind, quicki2c_remove() explicitly frees non-devm DMA
scatterlist buffers before the devm framework tears down this IRQ:

drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c:quicki2c_remove() {
    ...
    quicki2c_dma_deinit(qcdev);
    pm_runtime_get_noresume(qcdev->dev);
    quicki2c_dev_deinit(qcdev);
    ...
}

Because devres cleans up the IRQ only after remove() returns, and hardware
interrupts are disabled later in quicki2c_dev_deinit(), the IRQ can still
fire after quicki2c_dma_deinit() unmaps and frees the scatterlist arrays.

If a concurrent hardware interrupt fires, the unlocked read_dma_buffer()
might access the freed scatterlists:

drivers/hid/intel-thc-hid/intel-thc/intel-thc-dma.c:read_dma_buffer() {
    ...
    sg = read_config->sgls[prd_table_index];
    ret = sg_copy_to_buffer(sg, nent, read_buff, mes_len);
    ...
}

Can this lead to memory corruption if the handler executes on freed memory?

> -	if (ret) {
> -		dev_err_once(&pdev->dev,
> -			     "Failed to request threaded IRQ, irq = %d.\n", pdev->irq);
> +	if (ret)
>  		goto dev_deinit;
> -	}

[ ... ]

> diff --git a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
> index 4ae2e1718b30c..504ef3c842ab6 100644
> --- a/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
> +++ b/drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
> @@ -636,11 +636,8 @@ static int quickspi_probe(struct pci_dev *pdev,
>  					quickspi_irq_thread_handler,
>  					IRQF_ONESHOT, KBUILD_MODNAME,
>  					qsdev);

[Severity: High]
This isn't a bug introduced by this patch, but does the same regression
regarding shared INTx interrupts exist in quickspi_irq_quick_handler()?

drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c:quickspi_irq_quick_handler() {
    ...
    if (qsdev->state == QUICKSPI_DISABLED)
        return IRQ_HANDLED;
    ...
}

Returning IRQ_HANDLED without clearing the hardware condition might cause
an interrupt storm if the IRQ line is shared.

[Severity: Critical]
This is a pre-existing issue, but does the same use-after-free pattern
exist here during QuickSPI device removal?

drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c:quickspi_remove() {
    ...
    quickspi_dma_deinit(qsdev);
    pm_runtime_get_noresume(qsdev->dev);
    quickspi_dev_deinit(qsdev);
    ...
}

The devm-managed IRQ will remain active after quickspi_dma_deinit() frees
the scatterlists. Could a concurrent interrupt corrupt memory?

> -	if (ret) {
> -		dev_err(&pdev->dev,
> -			"Failed to request threaded IRQ, irq = %d.\n", pdev->irq);
> +	if (ret)
>  		goto dev_deinit;
> -	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260716075203.593012-1-panchuang@vivo.com?part=4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-16  8:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  7:51 [PATCH v2 0/4] HID: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-16  7:51 ` [PATCH v2 1/4] HID: amd_sfh: Remove redundant dev_err() Pan Chuang
2026-07-16  7:51 ` [PATCH v2 2/4] HID: hid-goodix: " Pan Chuang
2026-07-16  7:51 ` [PATCH v2 3/4] HID: intel-ish-hid: ipc: " Pan Chuang
2026-07-16  8:17   ` sashiko-bot
2026-07-16  7:51 ` [PATCH v2 4/4] HID: Intel-thc-hid: " Pan Chuang
2026-07-16  8:33   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.