[tip: x86/cache] fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()

tip-bot2 for Ben Horgan posted 1 patch 1 month ago
fs/resctrl/rdtgroup.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
[tip: x86/cache] fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()
Posted by tip-bot2 for Ben Horgan 1 month ago
The following commit has been merged into the x86/cache branch of tip:

Commit-ID:     7625632fed431ddd655e839c302165536553f767
Gitweb:        https://git.kernel.org/tip/7625632fed431ddd655e839c302165536553f767
Author:        Ben Horgan <ben.horgan@arm.com>
AuthorDate:    Wed, 06 May 2026 09:28:49 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Wed, 06 May 2026 19:06:52 +02:00

fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()

The error path in resctrl_mkdir_event_configs() is unnecessarily
complicated. Simplify it to just return directly on error.

Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Babu Moger <babu.moger@amd.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20260506082855.3694761-1-ben.horgan@arm.com
---
 fs/resctrl/rdtgroup.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 5dfdaa6..eca3bb6 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2331,22 +2331,19 @@ static int resctrl_mkdir_event_configs(struct rdt_resource *r, struct kernfs_nod
 			continue;
 
 		kn_subdir2 = kernfs_create_dir(kn_subdir, mevt->name, kn_subdir->mode, mevt);
-		if (IS_ERR(kn_subdir2)) {
-			ret = PTR_ERR(kn_subdir2);
-			goto out;
-		}
+		if (IS_ERR(kn_subdir2))
+			return PTR_ERR(kn_subdir2);
 
 		ret = rdtgroup_kn_set_ugid(kn_subdir2);
 		if (ret)
-			goto out;
+			return ret;
 
 		ret = rdtgroup_add_files(kn_subdir2, RFTYPE_ASSIGN_CONFIG);
 		if (ret)
-			break;
+			return ret;
 	}
 
-out:
-	return ret;
+	return 0;
 }
 
 static int rdtgroup_mkdir_info_resdir(void *priv, char *name,