pinctrl: aw9523: Destroy mutex on ->remove()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Fri, 29 Mar 2024 10:55:15 +0000 (12:55 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 4 Apr 2024 11:16:45 +0000 (13:16 +0200)
If aw9523_hw_init() fails on ->remove() the mutex left alive.
Destroy it in that case as well. While at it, remove never
true check at the beginning of the function.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Message-ID: <20240329105634.712457-2-andy.shevchenko@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-aw9523.c

index 4edd371c469fb6a8adeb672698e7916aec4603fc..66629af0b88b4bbf877f61bde83882fada97b16d 100644 (file)
@@ -1067,10 +1067,6 @@ err_disable_vregs:
 static void aw9523_remove(struct i2c_client *client)
 {
        struct aw9523 *awi = i2c_get_clientdata(client);
-       int ret;
-
-       if (!awi)
-               return;
 
        /*
         * If the chip VIO is connected to a regulator that we can turn
@@ -1082,10 +1078,8 @@ static void aw9523_remove(struct i2c_client *client)
                regulator_disable(awi->vio_vreg);
        } else {
                mutex_lock(&awi->i2c_lock);
-               ret = aw9523_hw_init(awi);
+               aw9523_hw_init(awi);
                mutex_unlock(&awi->i2c_lock);
-               if (ret)
-                       return;
        }
 
        mutex_destroy(&awi->i2c_lock);