Skip to contentSkip to conversation

platform/x86: dell-uart-backlight: switch to devm_mutex_init()

PATCH In review [email protected] 3 participants 4 messages Oct 26 – Nov 9 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: dell-uart-backlight: switch to devm_mutex_init()

From: Chitransh Mandhaniya <[email protected]>

Replace mutex_init() with devm_mutex_init() so that the mutex is automatically destroyed on driver removal via devres. The driver was missing a mutex_destroy() call on the teardown path.

---
 drivers/platform/x86/dell/dell-uart-backlight.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/dell/dell-uart-backlight.c +3 -1
index f323a667dc2d..2ed2f00d8c49 100644
@@ -279,7 +279,9 @@ static int dell_uart_bl_serdev_probe(struct serdev_device *serdev)
 	if (!dell_bl)
 		return -ENOMEM;
 
-	mutex_init(&dell_bl->mutex);
+	ret = devm_mutex_init(dev, &dell_bl->mutex);
+	if (ret)
+		return ret;
 	init_waitqueue_head(&dell_bl->wait_queue);
 	dell_bl->dev = dev;
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 8 lines · On 26-Oct-26 5:23 AM, [email protected] wrote:

From: Chitransh Mandhaniya <[email protected]>

Replace mutex_init() with devm_mutex_init() so that the mutex is automatically destroyed on driver removal via devres. The driver was missing a mutex_destroy() call on the teardown path.

Thanks, patch looks good to me:

Regards,

Hans

Quoted 19 lines
---
 drivers/platform/x86/dell/dell-uart-backlight.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/dell/dell-uart-backlight.c +3 -1
index f323a667dc2d..2ed2f00d8c49 100644
@@ -279,7 +279,9 @@ static int dell_uart_bl_serdev_probe(struct serdev_device *serdev)
 	if (!dell_bl)
 		return -ENOMEM;
 
-	mutex_init(&dell_bl->mutex);
+	ret = devm_mutex_init(dev, &dell_bl->mutex);
+	if (ret)
+		return ret;
 	init_waitqueue_head(&dell_bl->wait_queue);
 	dell_bl->dev = dev;
 
maintainer
#3 lore raw
In reply to [email protected]
Quoted 3 lines · On Mon, 26 Oct 2026 09:53:10 +0530, [email protected] wrote:

Replace mutex_init() with devm_mutex_init() so that the mutex is automatically destroyed on driver removal via devres. The driver was missing a mutex_destroy() call on the teardown path.

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: dell-uart-backlight: switch to devm_mutex_init()

      commit: b2ee01b0b19b3e7b3f1facfdad30c73bc69a3e51

--
i.