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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 28 Feb 2024 11:00:56 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: manivannan.sadhasivam@...aro.org
Cc: mhi@...ts.linux.dev,
	linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH v2] bus: mhi: ep: Simplify the allocation of slab caches in mhi_ep_register_controller

Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.

Signed-off-by: Kunwu Chan <chentao@...inos.cn>
---
v2:
    - Simplify the allocations of mhi_ring_element slab caches
---
 drivers/bus/mhi/ep/main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index 65fc1d738bec..795611482f16 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -1478,9 +1478,7 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
 		goto err_free_ch;
 	}
 
-	mhi_cntrl->ev_ring_el_cache = kmem_cache_create("mhi_ep_event_ring_el",
-							sizeof(struct mhi_ring_element), 0,
-							SLAB_CACHE_DMA, NULL);
+	mhi_cntrl->ev_ring_el_cache = KMEM_CACHE(mhi_ring_element, SLAB_CACHE_DMA);
 	if (!mhi_cntrl->ev_ring_el_cache) {
 		ret = -ENOMEM;
 		goto err_free_cmd;
@@ -1493,9 +1491,7 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
 		goto err_destroy_ev_ring_el_cache;
 	}
 
-	mhi_cntrl->ring_item_cache = kmem_cache_create("mhi_ep_ring_item",
-							sizeof(struct mhi_ep_ring_item), 0,
-							0, NULL);
+	mhi_cntrl->ring_item_cache = KMEM_CACHE(mhi_ep_ring_item, 0);
 	if (!mhi_cntrl->ev_ring_el_cache) {
 		ret = -ENOMEM;
 		goto err_destroy_tre_buf_cache;
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ