[-next,v2,2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()

Message ID 20240907034400.3693797-2-lizetao1@huawei.com (mailing list archive)
State Changes Requested
Headers
Series [-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

Li Zetao Sept. 7, 2024, 3:44 a.m. UTC
  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.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
v1 -> v2: Remove this check since debugfs_create_file can
handle IS_ERR pointers.
v1:
https://lore.kernel.org/all/20240903143607.2004802-2-lizetao1@huawei.com/

 drivers/media/common/siano/smsdvb-debugfs.c | 4 ----
 1 file changed, 4 deletions(-)
  

Comments

Greg KH Sept. 7, 2024, 5:48 a.m. UTC | #1
On Sat, Sep 07, 2024 at 11:44:00AM +0800, 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.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> v1 -> v2: Remove this check since debugfs_create_file can
> handle IS_ERR pointers.
> v1:
> https://lore.kernel.org/all/20240903143607.2004802-2-lizetao1@huawei.com/
> 
>  drivers/media/common/siano/smsdvb-debugfs.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
> index 73990e469df9..9db38ae4ecee 100644
> --- a/drivers/media/common/siano/smsdvb-debugfs.c
> +++ b/drivers/media/common/siano/smsdvb-debugfs.c
> @@ -411,10 +411,6 @@ void smsdvb_debugfs_register(void)
>  	 * subsystem.
>  	 */
>  	d = debugfs_create_dir("smsdvb", usb_debug_root);
> -	if (IS_ERR_OR_NULL(d)) {
> -		pr_err("Couldn't create sysfs node for smsdvb\n");
> -		return;
> -	}
>  	smsdvb_debugfs_usb_root = d;

Why is d even needed here, just assign it to smsdvb_debugfs_usb_root
directly, right?

thanks,

greg k-h
  

Patch

diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
index 73990e469df9..9db38ae4ecee 100644
--- a/drivers/media/common/siano/smsdvb-debugfs.c
+++ b/drivers/media/common/siano/smsdvb-debugfs.c
@@ -411,10 +411,6 @@  void smsdvb_debugfs_register(void)
 	 * subsystem.
 	 */
 	d = debugfs_create_dir("smsdvb", usb_debug_root);
-	if (IS_ERR_OR_NULL(d)) {
-		pr_err("Couldn't create sysfs node for smsdvb\n");
-		return;
-	}
 	smsdvb_debugfs_usb_root = d;
 }