[PATCH] eeprom: ee1004: Unlock on error path in probe()

From: Dan Carpenter
Date: Fri Jul 12 2024 - 10:04:34 EST


Call mutex_unlock() before returning an error in ee1004_probe()

Fixes: 55d57ef6fa97 ("eeprom: ee1004: Use devres for bus data cleanup")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
drivers/misc/eeprom/ee1004.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c
index d4aeeb2b2169..adba67cef1e7 100644
--- a/drivers/misc/eeprom/ee1004.c
+++ b/drivers/misc/eeprom/ee1004.c
@@ -272,8 +272,10 @@ static int ee1004_probe(struct i2c_client *client)
}

err = devm_add_action_or_reset(&client->dev, ee1004_cleanup_bus_data, bd);
- if (err < 0)
+ if (err < 0) {
+ mutex_unlock(&ee1004_bus_lock);
return err;
+ }

i2c_set_clientdata(client, bd);

--
2.43.0