All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
@ 2024-09-03 14:36 Li Zetao
  2024-09-03 14:36 ` [PATCH -next 2/2] media: siano: " Li Zetao
  2024-09-03 18:01 ` [PATCH -next 1/2] media: cec: " Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Li Zetao @ 2024-09-03 14:36 UTC (permalink / raw)
  To: hverkuil-cisco, mchehab, ricardo, laurent.pinchart+renesas,
	gregkh
  Cc: lizetao1, ruanjinjie, linux-media

Since the debugfs_create_dir() never returns a null pointer, checking
the return value for a null pointer is redundant, and using IS_ERR is
safe enough.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 drivers/media/cec/core/cec-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
index e0756826d629..b4135447cdae 100644
--- a/drivers/media/cec/core/cec-core.c
+++ b/drivers/media/cec/core/cec-core.c
@@ -441,7 +441,7 @@ static int __init cec_devnode_init(void)
 
 #ifdef CONFIG_DEBUG_FS
 	top_cec_dir = debugfs_create_dir("cec", NULL);
-	if (IS_ERR_OR_NULL(top_cec_dir)) {
+	if (IS_ERR(top_cec_dir)) {
 		pr_warn("cec: Failed to create debugfs cec dir\n");
 		top_cec_dir = NULL;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()
  2024-09-03 14:36 [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
@ 2024-09-03 14:36 ` Li Zetao
  2024-09-03 18:01   ` Greg KH
  2024-09-03 18:01 ` [PATCH -next 1/2] media: cec: " Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Li Zetao @ 2024-09-03 14:36 UTC (permalink / raw)
  To: hverkuil-cisco, mchehab, ricardo, laurent.pinchart+renesas,
	gregkh
  Cc: lizetao1, ruanjinjie, linux-media

Since the debugfs_create_dir() never returns a null pointer, checking
the return value for a null pointer is redundant, and using IS_ERR is
safe enough.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 drivers/media/common/siano/smsdvb-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init()
  2024-09-03 14:36 [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
  2024-09-03 14:36 ` [PATCH -next 2/2] media: siano: " Li Zetao
@ 2024-09-03 18:01 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2024-09-03 18:01 UTC (permalink / raw)
  To: Li Zetao
  Cc: hverkuil-cisco, mchehab, ricardo, laurent.pinchart+renesas,
	ruanjinjie, linux-media

On Tue, Sep 03, 2024 at 10:36:06PM +0800, Li Zetao wrote:
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant, and using IS_ERR is
> safe enough.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>  drivers/media/cec/core/cec-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c
> index e0756826d629..b4135447cdae 100644
> --- a/drivers/media/cec/core/cec-core.c
> +++ b/drivers/media/cec/core/cec-core.c
> @@ -441,7 +441,7 @@ static int __init cec_devnode_init(void)
>  
>  #ifdef CONFIG_DEBUG_FS

This ifdef should not be needed.

>  	top_cec_dir = debugfs_create_dir("cec", NULL);
> -	if (IS_ERR_OR_NULL(top_cec_dir)) {
> +	if (IS_ERR(top_cec_dir)) {
>  		pr_warn("cec: Failed to create debugfs cec dir\n");

No need to tell anyone anything, or ever check the return value of a
debugfs call, please change the logic to that.

>  		top_cec_dir = NULL;

Not needed either.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next 2/2] media: siano: remove redundant null pointer checks in cec_devnode_init()
  2024-09-03 14:36 ` [PATCH -next 2/2] media: siano: " Li Zetao
@ 2024-09-03 18:01   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2024-09-03 18:01 UTC (permalink / raw)
  To: Li Zetao
  Cc: hverkuil-cisco, mchehab, ricardo, laurent.pinchart+renesas,
	ruanjinjie, linux-media

On Tue, Sep 03, 2024 at 10:36:07PM +0800, Li Zetao wrote:
> Since the debugfs_create_dir() never returns a null pointer, checking
> the return value for a null pointer is redundant, and using IS_ERR is
> safe enough.
> 
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
>  drivers/media/common/siano/smsdvb-debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
> index 73990e469df9..325d674c74d9 100644
> --- a/drivers/media/common/siano/smsdvb-debugfs.c
> +++ b/drivers/media/common/siano/smsdvb-debugfs.c
> @@ -411,7 +411,7 @@ void smsdvb_debugfs_register(void)
>  	 * subsystem.
>  	 */
>  	d = debugfs_create_dir("smsdvb", usb_debug_root);
> -	if (IS_ERR_OR_NULL(d)) {
> +	if (IS_ERR(d)) {
>  		pr_err("Couldn't create sysfs node for smsdvb\n");

Again, just do not check.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-03 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 14:36 [PATCH -next 1/2] media: cec: remove redundant null pointer checks in cec_devnode_init() Li Zetao
2024-09-03 14:36 ` [PATCH -next 2/2] media: siano: " Li Zetao
2024-09-03 18:01   ` Greg KH
2024-09-03 18:01 ` [PATCH -next 1/2] media: cec: " Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.