usb: typec: tps6598x: Fix fault at module removal
authorRoger Quadros <rogerq@kernel.org>
Fri, 21 Apr 2023 10:17:20 +0000 (13:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 May 2023 09:51:09 +0000 (18:51 +0900)
We need to cancel the delayed workqueue if it is being used
else it will cause paging request fault during module removal.

Fixes: 0d6a119cecd7 ("usb: typec: tps6598x: Add support for polling interrupts status")
Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230421101720.34318-1-rogerq@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tipd/core.c

index 8b075ca..438cc40 100644 (file)
@@ -886,6 +886,9 @@ static void tps6598x_remove(struct i2c_client *client)
 {
        struct tps6598x *tps = i2c_get_clientdata(client);
 
+       if (!client->irq)
+               cancel_delayed_work_sync(&tps->wq_poll);
+
        tps6598x_disconnect(tps, 0);
        typec_unregister_port(tps->port);
        usb_role_switch_put(tps->role_sw);