lantiq: use devm for mutex_init
authorRosen Penev <rosenp@gmail.com>
Thu, 31 Oct 2024 19:22:04 +0000 (12:22 -0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 10 Nov 2024 21:39:45 +0000 (22:39 +0100)
It's common to avoid calling mutex_destroy when done. It's not correct strictly speaking.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16832
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/lantiq/patches-6.6/0008-MIPS-lantiq-backport-old-timer-code.patch

index 81bf72913b66f47839daf43c0f23009e2a337559..a396efd99078f6b17f01e362ae047d0b674d4f8f 100644 (file)
@@ -186,7 +186,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  obj-y += vmmc.o
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/timer.c
-@@ -0,0 +1,886 @@
+@@ -0,0 +1,888 @@
 +#ifndef CONFIG_SOC_AMAZON_SE
 +
 +#include <linux/kernel.h>
@@ -989,7 +989,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +      ltq_w32(0xfff, LQ_GPTU_IRNCR);
 +
 +      memset(&timer_dev, 0, sizeof(timer_dev));
-+      mutex_init(&timer_dev.gptu_mutex);
++      ret = devm_mutex_init(&pdev->dev, &timer_dev.gptu_mutex);
++      if (ret)
++              return ret;
 +
 +      lq_enable_gptu();
 +      timer_dev.number_of_timers = GPTU_ID_CFG * 2;