[PATCH v4 1/7] fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()

Ben Horgan
2026-03-26T17:26:02Z

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>
---
fs/resctrl/rdtgroup.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 5da305bd36c9..4753841c2ca3 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2331,20 +2331,19 @@ static int resctrl_mkdir_event_configs(struct rdt_resource *r, struct kernfs_nod
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;
+ return ret;
}

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,
--
2.43.0