Skip to contentSkip to conversation

nfc: nxp-nci: Add remove on IRQ error

PATCH In review Greg Kroah-Hartman 2 participants 2 messages Jul 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfc: nxp-nci: Add remove on IRQ error

From: Griffin Kroah-Hartman <[email protected]>

Add a call to nxp_nci_remove() in nxp_nci_i2c_probe() when the request_threaded_irq() fails.
Previously, IRQ resources were not being freed upon error.

Assisted-by gkh_clanker_2000
Cc David Heidelberg <[email protected]>
Cc Carl Lee <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Ian Ray <[email protected]>
Cc "Uwe Kleine-König (The Capable Hub)" <[email protected]>
---
 drivers/nfc/nxp-nci/i2c.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +3 -1
index faebc89a7ef5..564f38735510 100644
@@ -334,8 +334,10 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
 				 nxp_nci_i2c_irq_thread_fn,
 				 irqflags | IRQF_ONESHOT,
 				 NXP_NCI_I2C_DRIVER_NAME, phy);
-	if (r < 0)
+	if (r < 0) {
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");
+		nxp_nci_remove(phy->ndev);
+	}
 
 	return r;
 }
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Greg Kroah-Hartman

From: Griffin Kroah-Hartman <[email protected]>

Add a call to nxp_nci_remove() in nxp_nci_i2c_probe() when the request_threaded_irq() fails.
Previously, IRQ resources were not being freed upon error.

Quoted 9 lines
Assisted-by gkh_clanker_2000
Cc David Heidelberg <[email protected]>
Cc Carl Lee <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Ian Ray <[email protected]>
Cc "Uwe Kleine-König (The Capable Hub)" <[email protected]>

Nice improvement!

Quoted 23 lines
---
 drivers/nfc/nxp-nci/i2c.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +3 -2
index faebc89a7ef5..564f38735510 100644
@@ -334,8 +334,10 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
                                 nxp_nci_i2c_irq_thread_fn,
                                 irqflags | IRQF_ONESHOT,
                                 NXP_NCI_I2C_DRIVER_NAME, phy);
-       if (r < 0)
+       if (r < 0) {
                nfc_err(&client->dev, "Unable to register IRQ handler\n");
+               nxp_nci_remove(phy->ndev);
+       }
 
        return r;
 }
--

2.55.0