Skip to contentSkip to conversation

ASoC: nau8821: Don't unconditionally free interrupt

PATCH In review Mark Brown 2 participants 2 messages Jul 18, 2022 – Jul 19, 2022

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: nau8821: Don't unconditionally free interrupt

The remove() operation unconditionally frees the interrupt for the device but we may not actually have an interrupt so there might be nothing to free. Since the interrupt is requested after all other resources we don't need the explicit free anyway, unwinding is guaranteed to be safe, so just delete the remove() function and let devm take care of things.

---
 sound/soc/codecs/nau8821.c | 10 ----------
 1 file changed, 10 deletions(-)
sound/soc/codecs/nau8821.c +0 -10
index 2600be250a3c..3ce23c20eca9 100644
@@ -1699,15 +1699,6 @@ static int nau8821_i2c_probe(struct i2c_client *i2c)
 	return ret;
 }
 
-static int nau8821_i2c_remove(struct i2c_client *i2c_client)
-{
-	struct nau8821 *nau8821 = i2c_get_clientdata(i2c_client);
-
-	devm_free_irq(nau8821->dev, nau8821->irq, nau8821);
-
-	return 0;
-}
-
 static const struct i2c_device_id nau8821_i2c_ids[] = {
 	{ "nau8821", 0 },
 	{ }
@@ -1737,7 +1728,6 @@ static struct i2c_driver nau8821_driver = {
 		.acpi_match_table = ACPI_PTR(nau8821_acpi_match),
 	},
 	.probe_new = nau8821_i2c_probe,
-	.remove = nau8821_i2c_remove,
 	.id_table = nau8821_i2c_ids,
 };
 module_i2c_driver(nau8821_driver);
Signature · 1 line
2.30.2
Tested-by on v1 1/1
#1 lore raw

Hi,

Quoted 42 lines · Mark Brown

The remove() operation unconditionally frees the interrupt for the device but we may not actually have an interrupt so there might be nothing to free. Since the interrupt is requested after all other resources we don't need the explicit free anyway, unwinding is guaranteed to be safe, so just delete the remove() function and let devm take care of things.

---
 sound/soc/codecs/nau8821.c | 10 ----------
 1 file changed, 10 deletions(-)
sound/soc/codecs/nau8821.c +0 -11
index 2600be250a3c..3ce23c20eca9 100644
@@ -1699,15 +1699,6 @@ static int nau8821_i2c_probe(struct i2c_client *i2c)
        return ret;
 }
 
-static int nau8821_i2c_remove(struct i2c_client *i2c_client)
-{
-       struct nau8821 *nau8821 = i2c_get_clientdata(i2c_client);
-
-       devm_free_irq(nau8821->dev, nau8821->irq, nau8821);
-
-       return 0;
-}
-
 static const struct i2c_device_id nau8821_i2c_ids[] = {
        { "nau8821", 0 },
        { }
@@ -1737,7 +1728,6 @@ static struct i2c_driver nau8821_driver = {
                .acpi_match_table = ACPI_PTR(nau8821_acpi_match),
        },
        .probe_new = nau8821_i2c_probe,
-       .remove = nau8821_i2c_remove,
        .id_table = nau8821_i2c_ids,
 };
 module_i2c_driver(nau8821_driver);
--
Quoted 1 line

2.30.2

Thanks for your patch, it works for me :)

regards,
Zheyu Ma