[-next,v2,1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
Checks
Context |
Check |
Description |
media-ci/HTML_report |
success
|
Link
|
media-ci/report |
success
|
Link
|
media-ci/virtme32 |
success
|
Link
|
media-ci/virtme64 |
fail
|
Link
|
media-ci/bisect |
success
|
Link
|
media-ci/doc |
success
|
Link
|
media-ci/build |
success
|
Link
|
media-ci/static-upstream |
success
|
Link
|
media-ci/abi |
success
|
Link
|
media-ci/media-patchstyle |
success
|
Link
|
media-ci/checkpatch |
success
|
Link
|
Commit Message
Since the debugfs_create_dir() never returns a null pointer, checking
the return value for a null pointer is redundant. Remove this check
since debugfs_create_file can handle IS_ERR pointers. At the same time,
debugfs_create_dir returns ERR_PTR (-ENODEV) by default when
CONFIG_DEBUG_FS=N, so there is no need for CONFIG_DEBUG_FS macro
isolation.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
v1 -> v2: Remove this check since debugfs_create_file can handle IS_ERR
pointers. And drop the ifdef CONFIG_DEBUG_FS statement.
v1:
https://lore.kernel.org/all/20240903143607.2004802-1-lizetao1@huawei.com/
drivers/media/cec/core/cec-core.c | 6 ------
1 file changed, 6 deletions(-)
Comments
On 07/09/2024 05:43, Li Zetao wrote:
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant. Remove this check
> since debugfs_create_file can handle IS_ERR pointers. At the same time,
> debugfs_create_dir returns ERR_PTR (-ENODEV) by default when
> CONFIG_DEBUG_FS=N, so there is no need for CONFIG_DEBUG_FS macro
> isolation.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> v1 -> v2: Remove this check since debugfs_create_file can handle IS_ERR
> pointers. And drop the ifdef CONFIG_DEBUG_FS statement.
> v1:
> https://lore.kernel.org/all/20240903143607.2004802-1-lizetao1@huawei.com/
>
> drivers/media/cec/core/cec-core.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
> index e0756826d629..77be6c11c63c 100644
> --- a/drivers/media/cec/core/cec-core.c
> +++ b/drivers/media/cec/core/cec-core.c
> @@ -439,13 +439,7 @@ static int __init cec_devnode_init(void)
> return ret;
> }
>
> -#ifdef CONFIG_DEBUG_FS
> top_cec_dir = debugfs_create_dir("cec", NULL);
> - if (IS_ERR_OR_NULL(top_cec_dir)) {
> - pr_warn("cec: Failed to create debugfs cec dir\n");
> - top_cec_dir = NULL;
> - }
> -#endif
>
> ret = bus_register(&cec_bus_type);
> if (ret < 0) {
Check all users of top_cec_dir, you'll need to make more changes in this source.
Regards,
Hans
@@ -439,13 +439,7 @@ static int __init cec_devnode_init(void)
return ret;
}
-#ifdef CONFIG_DEBUG_FS
top_cec_dir = debugfs_create_dir("cec", NULL);
- if (IS_ERR_OR_NULL(top_cec_dir)) {
- pr_warn("cec: Failed to create debugfs cec dir\n");
- top_cec_dir = NULL;
- }
-#endif
ret = bus_register(&cec_bus_type);
if (ret < 0) {