debugfs_create_dir() has a proper logic to handle existing directories.
Skip the manual test. Additionally quit early if directory creation fails.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21157
Signed-off-by: Robert Marko <robimarko@gmail.com>
dbg_info->ctrl = ctrl;
dbg_info->sds = sds;
- root = debugfs_lookup(RTSDS_DBG_ROOT_DIR, NULL);
- if (!root)
- root = debugfs_create_dir(RTSDS_DBG_ROOT_DIR, NULL);
+ root = debugfs_create_dir(RTSDS_DBG_ROOT_DIR, NULL);
+ if (IS_ERR(root))
+ return PTR_ERR(root);
snprintf(dirname, sizeof(dirname), "serdes.%d", sds);
dir = debugfs_create_dir(dirname, root);