* [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()
2024-09-07 3:09 [PATCH net-next v2 00/10] net: Convert using devm_clk_get_enabled()/devm_clk_get_optional_enabled() Li Zetao
@ 2024-09-07 3:10 ` Li Zetao
0 siblings, 0 replies; 5+ messages in thread
From: Li Zetao @ 2024-09-07 3:10 UTC (permalink / raw)
To: mchehab, davem, edumazet, kuba, pabeni, wens, jernej.skrabec,
samuel, heiko, yisen.zhuang, salil.mehta, hauke, alexandre.torgue,
joabreu, mcoquelin.stm32, wellslutw, radhey.shyam.pandey,
michal.simek, hdegoede, ilpo.jarvinen, lizetao1, ruanjinjie,
hverkuil-cisco, u.kleine-koenig, jacky_chou, jacob.e.keller
Cc: linux-media, netdev, linux-arm-kernel, linux-sunxi,
linux-rockchip, linux-stm32, platform-driver-x86
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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
@ 2024-09-07 3:43 Li Zetao
2024-09-07 3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
2024-09-09 11:49 ` [PATCH -next v2 1/2] media: cec: " Hans Verkuil
0 siblings, 2 replies; 5+ messages in thread
From: Li Zetao @ 2024-09-07 3:43 UTC (permalink / raw)
To: hverkuil-cisco, mchehab, gregkh, lizetao1,
laurent.pinchart+renesas, ricardo, ruanjinjie
Cc: linux-media
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) {
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()
2024-09-07 3:43 [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
@ 2024-09-07 3:44 ` Li Zetao
2024-09-07 5:48 ` Greg KH
2024-09-09 11:49 ` [PATCH -next v2 1/2] media: cec: " Hans Verkuil
1 sibling, 1 reply; 5+ messages in thread
From: Li Zetao @ 2024-09-07 3:44 UTC (permalink / raw)
To: hverkuil-cisco, mchehab, gregkh, lizetao1,
laurent.pinchart+renesas, ricardo, ruanjinjie
Cc: linux-media
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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()
2024-09-07 3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
@ 2024-09-07 5:48 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2024-09-07 5:48 UTC (permalink / raw)
To: Li Zetao
Cc: hverkuil-cisco, mchehab, laurent.pinchart+renesas, ricardo,
ruanjinjie, linux-media
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
2024-09-07 3:43 [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
2024-09-07 3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
@ 2024-09-09 11:49 ` Hans Verkuil
1 sibling, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2024-09-09 11:49 UTC (permalink / raw)
To: Li Zetao, mchehab, gregkh, laurent.pinchart+renesas, ricardo,
ruanjinjie
Cc: linux-media
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-09 11:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-07 3:43 [PATCH -next v2 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
2024-09-07 3:44 ` [PATCH -next v2 2/2] media: siano: " Li Zetao
2024-09-07 5:48 ` Greg KH
2024-09-09 11:49 ` [PATCH -next v2 1/2] media: cec: " Hans Verkuil
-- strict thread matches above, loose matches on Subject: below --
2024-09-07 3:09 [PATCH net-next v2 00/10] net: Convert using devm_clk_get_enabled()/devm_clk_get_optional_enabled() Li Zetao
2024-09-07 3:10 ` [PATCH -next v2 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init() Li Zetao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox