lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240910154803.736951-1-lizetao1@huawei.com>
Date: Tue, 10 Sep 2024 23:48:02 +0800
From: Li Zetao <lizetao1@...wei.com>
To: <hverkuil-cisco@...all.nl>, <mchehab@...nel.org>,
	<gregkh@...uxfoundation.org>, <ricardo@...liere.net>, <ruanjinjie@...wei.com>
CC: <lizetao1@...wei.com>, <linux-media@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: [PATCH -next v3 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()

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@...wei.com>
---
v2 -> v3: Drop the null pointer check for top_cec_dir
v2: https://lore.kernel.org/all/20240907034400.3693797-1-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 | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
index e0756826d629..2897283ebe72 100644
--- a/drivers/media/cec/core/cec-core.c
+++ b/drivers/media/cec/core/cec-core.c
@@ -374,10 +374,6 @@ int cec_register_adapter(struct cec_adapter *adap,
 	}
 
 	dev_set_drvdata(&adap->devnode.dev, adap);
-#ifdef CONFIG_DEBUG_FS
-	if (!top_cec_dir)
-		return 0;
-
 	adap->cec_dir = debugfs_create_dir(dev_name(&adap->devnode.dev),
 					   top_cec_dir);
 
@@ -388,7 +384,6 @@ int cec_register_adapter(struct cec_adapter *adap,
 		return 0;
 	debugfs_create_file("error-inj", 0644, adap->cec_dir, adap,
 			    &cec_error_inj_fops);
-#endif
 	return 0;
 }
 EXPORT_SYMBOL_GPL(cec_register_adapter);
@@ -439,13 +434,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) {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ