The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] nfc: st-nci: Add error handling to IRQ handlers
@ 2026-07-07 14:21 Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2026-07-07 14:21 UTC (permalink / raw)
  To: oe-linux-nfc
  Cc: linux-kernel, Griffin Kroah-Hartman, David Heidelberg,
	Uwe Kleine-König (The Capable Hub), Krzysztof Kozlowski,
	Greg Kroah-Hartman

From: Griffin Kroah-Hartman <griffin@kroah.com>

Add ndlc_remove() to st_nci_i2c_probe() and st_nci_spi_probe() if the
devm_request_threaded_irq() function fails.  This is to properly unwind
after ndlc_probe() was called prior to this.

Assisted-by: gkh_clanker_2000
Cc: David Heidelberg <david@ixit.cz>
Cc: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/nfc/st-nci/i2c.c | 4 +++-
 drivers/nfc/st-nci/spi.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c
index 9ae839a6f5cc..7f727d9b97ba 100644
--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -243,8 +243,10 @@ static int st_nci_i2c_probe(struct i2c_client *client)
 				st_nci_irq_thread_fn,
 				IRQF_ONESHOT,
 				ST_NCI_DRIVER_NAME, phy);
-	if (r < 0)
+	if (r < 0) {
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");
+		ndlc_remove(phy->ndlc);
+	}
 
 	return r;
 }
diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c
index 169eacc0a32a..6f1ffd8244fa 100644
--- a/drivers/nfc/st-nci/spi.c
+++ b/drivers/nfc/st-nci/spi.c
@@ -257,8 +257,10 @@ static int st_nci_spi_probe(struct spi_device *dev)
 				st_nci_irq_thread_fn,
 				IRQF_ONESHOT,
 				ST_NCI_SPI_DRIVER_NAME, phy);
-	if (r < 0)
+	if (r < 0) {
 		nfc_err(&dev->dev, "Unable to register IRQ handler\n");
+		ndlc_remove(phy->ndlc);
+	}
 
 	return r;
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-07 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 14:21 [PATCH] nfc: st-nci: Add error handling to IRQ handlers Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox