lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250811153934.671070-4-xiangrongl@nvidia.com>
Date: Mon, 11 Aug 2025 15:39:33 +0000
From: Ron Li <xiangrongl@...dia.com>
To: <hdegoede@...hat.com>, <ilpo.jarvinen@...ux.intel.com>,
	<vadimp@...dia.com>, <alok.a.tiwari@...cle.com>, <kblaiech@...dia.com>,
	<davthompson@...dia.com>
CC: <platform-driver-x86@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	"Ron Li" <xiangrongl@...dia.com>
Subject: [PATCH v2 3/4] platform/mellanox/mlxbf_pka: add devm_mutex_init() to initialize mutex

Reviewed-by: David Thompson <davthompson@...dia.com>
Reviewed-by: Khalil Blaiech <kblaiech@...dia.com>
Signed-off-by: Ron Li <xiangrongl@...dia.com>
---
 drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_dev.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_dev.c b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_dev.c
index a0282ae0c62e..9b52d1170900 100644
--- a/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_dev.c
+++ b/drivers/platform/mellanox/mlxbf_pka/mlxbf_pka_dev.c
@@ -296,6 +296,7 @@ static int mlxbf_pka_dev_init_ring(struct device *dev,
 	u32 ring_mem_base;
 	u32 ring_mem_off;
 	u32 shim_ring_id;
+	int ret;
 
 	if (ring->status != MLXBF_PKA_DEV_RING_STATUS_UNDEFINED) {
 		dev_err(dev, "PKA ring must be undefined\n");
@@ -354,7 +355,10 @@ static int mlxbf_pka_dev_init_ring(struct device *dev,
 	if (!ring->ring_info)
 		return -ENOMEM;
 
-	mutex_init(&ring->mutex);
+	ret = devm_mutex_init(dev, &ring->mutex);
+	if (ret)
+		return ret;
+
 	ring->status = MLXBF_PKA_DEV_RING_STATUS_INITIALIZED;
 
 	return 0;
@@ -1455,7 +1459,10 @@ static int mlxbf_pka_dev_init_shim(struct device *dev, struct mlxbf_pka_dev_shim
 		shim->trng_enabled = MLXBF_PKA_SHIM_TRNG_DISABLED;
 	}
 
-	mutex_init(&shim->mutex);
+	ret = devm_mutex_init(dev, &shim->mutex);
+	if (ret)
+		return ret;
+
 	shim->busy_ring_num = 0;
 	shim->status = MLXBF_PKA_SHIM_STATUS_INITIALIZED;
 
-- 
2.43.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ