From 95b2a034784658c4512db846918475d4954901d6 Mon Sep 17 00:00:00 2001 From: Zhen Lei Date: Sat, 26 Nov 2022 19:16:34 +0800 Subject: kernfs: remove an unused if statement in kernfs_path_from_node_locked() It makes no sense to call kernfs_path_from_node_locked() with NULL buf, and no one is doing that right now. Suggested-by: Tejun Heo Signed-off-by: Zhen Lei Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20221126111634.1994-1-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman --- fs/kernfs/dir.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'fs') diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 935ef8cb02b2..7b13b1c3424c 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -149,9 +149,6 @@ static int kernfs_path_from_node_locked(struct kernfs_node *kn_to, if (kn_from == kn_to) return strlcpy(buf, "/", buflen); - if (!buf) - return -EINVAL; - common = kernfs_common_ancestor(kn_from, kn_to); if (WARN_ON(!common)) return -EINVAL; -- cgit v1.2.3 From 56d5f362ad0f8f60bc7c6fd5d7bc2b528d6963f5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 11 Jan 2023 12:30:18 +0100 Subject: kobject: kset_uevent_ops: make uevent() callback take a const * The uevent() callback in struct kset_uevent_ops does not modify the kobject passed into it, so make the pointer const to enforce this restriction. When doing so, fix up all existing uevent() callbacks to have the correct signature to preserve the build. Cc: Christine Caulfield Cc: David Teigland Cc: Bob Peterson Cc: Andreas Gruenbacher Acked-by: Rafael J. Wysocki Acked-by: Hans de Goede Link: https://lore.kernel.org/r/20230111113018.459199-17-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'fs') diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index d0b4e2181a5f..9b6cfc4c30e3 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -215,9 +215,9 @@ static int do_uevent(struct dlm_ls *ls, int in) return ls->ls_uevent_result; } -static int dlm_uevent(struct kobject *kobj, struct kobj_uevent_env *env) +static int dlm_uevent(const struct kobject *kobj, struct kobj_uevent_env *env) { - struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); + const struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); add_uevent_var(env, "LOCKSPACE=%s", ls->ls_name); return 0; diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index d87ea98cf535..d8dfabb0bc12 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c @@ -767,10 +767,10 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp) wait_for_completion(&sdp->sd_kobj_unregister); } -static int gfs2_uevent(struct kobject *kobj, struct kobj_uevent_env *env) +static int gfs2_uevent(const struct kobject *kobj, struct kobj_uevent_env *env) { - struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); - struct super_block *s = sdp->sd_vfs; + const struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); + const struct super_block *s = sdp->sd_vfs; add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name); add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name); -- cgit v1.2.3 From d3002468cb5d5da11e22145c9af32facd5c34352 Mon Sep 17 00:00:00 2001 From: Qi Zheng Date: Wed, 8 Feb 2023 11:56:34 +0800 Subject: debugfs: update comment of debugfs_rename() Since commit ff9fb72bc077 ("debugfs: return error values, not NULL") changed return value of debugfs_rename() in error cases from %NULL to %ERR_PTR(-ERROR), the comment of debugfs_rename should also be updated so as not to mislead readers. Signed-off-by: Qi Zheng Link: https://lore.kernel.org/r/20230208035634.58095-1-zhengqi.arch@bytedance.com Signed-off-by: Greg Kroah-Hartman --- fs/debugfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 2e8e112b1993..58a35afb7c5d 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -802,8 +802,8 @@ EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove); * exist for rename to succeed. * * This function will return a pointer to old_dentry (which is updated to - * reflect renaming) if it succeeds. If an error occurs, %NULL will be - * returned. + * reflect renaming) if it succeeds. If an error occurs, %ERR_PTR(-ERROR) + * will be returned. * * If debugfs is not enabled in the kernel, the value -%ENODEV will be * returned. -- cgit v1.2.3 From 88cd618dcc7b63baa1478730b02eaba3e3148467 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Mon, 20 Feb 2023 19:47:21 +0700 Subject: debugfs: drop inline constant formatting for ERR_PTR(-ERROR) Stephen Rothwell reported htmldocs warning when merging driver-core tree for linux-next: Documentation/filesystems/api-summary:146: fs/debugfs/inode.c:804: WARNING: Inline literal start-string without end-string. The warning is due to inline constant formatting (``%CONST``) doesn't play nice with complex-name constants like ERR_PTR(-ERROR). Drop the formatting for that constant above to be consistent with similar error constants and also to fix the above warning. Link: https://lore.kernel.org/lkml/20230220163133.481e43d8@canb.auug.org.au/ Fixes: d3002468cb5d5d ("debugfs: update comment of debugfs_rename()") Reported-by: Stephen Rothwell Signed-off-by: Bagas Sanjaya Link: https://lore.kernel.org/r/20230220124721.11657-1-bagasdotme@gmail.com Signed-off-by: Greg Kroah-Hartman --- fs/debugfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 58a35afb7c5d..a7a6a0821605 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -802,7 +802,7 @@ EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove); * exist for rename to succeed. * * This function will return a pointer to old_dentry (which is updated to - * reflect renaming) if it succeeds. If an error occurs, %ERR_PTR(-ERROR) + * reflect renaming) if it succeeds. If an error occurs, ERR_PTR(-ERROR) * will be returned. * * If debugfs is not enabled in the kernel, the value -%ENODEV will be -- cgit v1.2.3