Input: elan_i2c - switch to using devm_add_action_or_reset()
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 13 Jul 2019 08:18:14 +0000 (01:18 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 24 Jul 2019 09:58:52 +0000 (12:58 +0300)
Instead of manually disabling regulators when devm_add_action() fails we can
use devm_add_action_or_reset() which does it for us.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/mouse/elan_i2c_core.c

index b549d032da938df5d65068e95dd633dcfdd60111..8719da54038346b0441f74cd72fc4af7c48ed1a7 100644 (file)
@@ -1187,9 +1187,8 @@ static int elan_probe(struct i2c_client *client,
                return error;
        }
 
-       error = devm_add_action(dev, elan_disable_regulator, data);
+       error = devm_add_action_or_reset(dev, elan_disable_regulator, data);
        if (error) {
-               regulator_disable(data->vcc);
                dev_err(dev, "Failed to add disable regulator action: %d\n",
                        error);
                return error;