mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree()
@ 2025-06-23  7:50 Shaopeng Tan
  2025-06-24  3:51 ` Koba Ko
  0 siblings, 1 reply; 5+ messages in thread
From: Shaopeng Tan @ 2025-06-23  7:50 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Reinette Chatre, James Morse, Yury Norov, Dave Martin, fenghuay,
	peternewman, Babu Moger, Borislav Petkov,
	shameerali.kolothum.thodi, bobo.shaobowang, D Scott Phillips OS,
	carl, Koba Ko, Shanker Donthineni, Xin Hao, baolin.wang,
	lcherian, amitsinght, Ingo Molnar, David Hildenbrand,
	H Peter Anvin, Rex Nie, Jamie Iles, dfustini, Thomas Gleixner

schemata_list_destroy() has to be called if schemata_list_create() fails.

rdt_get_tree() calls schemata_list_destroy() in two different ways:
directly if schemata_list_create() itself fails and
on the exit path via the out_schemata_free goto label.

Remove schemata_list_destroy() call on schemata_list_create() failure.
Use existing out_schemata_free goto label instead.

Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: James Morse <james.morse@arm.com>
---
 fs/resctrl/rdtgroup.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 77d08229d855..5f0b7cfa1cc2 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2608,10 +2608,8 @@ static int rdt_get_tree(struct fs_context *fc)
 		goto out_root;
 
 	ret = schemata_list_create();
-	if (ret) {
-		schemata_list_destroy();
-		goto out_ctx;
-	}
+	if (ret)
+		goto out_schemata_free;
 
 	ret = closid_init();
 	if (ret)
@@ -2683,7 +2681,6 @@ static int rdt_get_tree(struct fs_context *fc)
 	closid_exit();
 out_schemata_free:
 	schemata_list_destroy();
-out_ctx:
 	rdt_disable_ctx();
 out_root:
 	rdtgroup_destroy_root();
-- 
2.43.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-18 15:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250623073154.3320458-1-tan.shaopeng@jp.fujitsu.com>
2025-07-18  5:55 ` [PATCH v2] fs/resctrl: Optimize code in rdt_get_tree() Shaopeng Tan (Fujitsu)
2025-07-18 15:48   ` Reinette Chatre
2025-06-23  7:50 Shaopeng Tan
2025-06-24  3:51 ` Koba Ko
2025-07-18  5:54   ` Shaopeng Tan (Fujitsu)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®