[PATCH v3 2/5] i2c: xiic: switch to managed version of mutex_init
Abdurrahman Hussain via B4 Relay
devnull+abdurrahman.nexthop.ai at kernel.org
Fri Jan 23 00:02:45 PST 2026
From: Abdurrahman Hussain <abdurrahman at nexthop.ai>
Simplify the error path by switching to a managed version of mutex_init.
Signed-off-by: Abdurrahman Hussain <abdurrahman at nexthop.ai>
---
drivers/i2c/busses/i2c-xiic.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 603a246a1445..79643c27e75d 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -1461,7 +1461,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
snprintf(i2c->adap.name, sizeof(i2c->adap.name),
DRIVER_NAME " %s", pdev->name);
- mutex_init(&i2c->lock);
+ ret = devm_mutex_init(&pdev->dev, &i2c->lock);
+ if (ret < 0)
+ return ret;
+
spin_lock_init(&i2c->atomic_lock);
i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
--
2.52.0
More information about the linux-arm-kernel
mailing list