diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-04-15 20:23:33 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2023-05-08 15:29:11 +0200 |
commit | 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 (patch) | |
tree | 2e563a29a4770d8eddaaa8bde706e9f57b693c30 /drivers/power | |
parent | power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition (diff) | |
download | linux-444ff00734f3878cd54ddd1ed5e2e6dbea9326d5.tar.xz linux-444ff00734f3878cd54ddd1ed5e2e6dbea9326d5.zip |
power: supply: bq27xxx: Fix I2C IRQ race on remove
devm_request_threaded_irq() requested IRQs are only free-ed after
the driver's remove function has ran. So the IRQ could trigger and
call bq27xxx_battery_update() after bq27xxx_battery_teardown() has
already run.
Switch to explicitly free-ing the IRQ in bq27xxx_battery_i2c_remove()
to fix this.
Fixes: 8807feb91b76 ("power: bq27xxx_battery: Add interrupt handling support")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/bq27xxx_battery_i2c.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c index f8768997333b..6d3c74876339 100644 --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c @@ -179,7 +179,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client) i2c_set_clientdata(client, di); if (client->irq) { - ret = devm_request_threaded_irq(&client->dev, client->irq, + ret = request_threaded_irq(client->irq, NULL, bq27xxx_battery_irq_handler_thread, IRQF_ONESHOT, di->name, di); @@ -209,6 +209,7 @@ static void bq27xxx_battery_i2c_remove(struct i2c_client *client) { struct bq27xxx_device_info *di = i2c_get_clientdata(client); + free_irq(client->irq, di); bq27xxx_battery_teardown(di); mutex_lock(&battery_mutex); |