* [PATCH v1] drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
@ 2024-08-21 8:39 Yang Ruibin
2024-08-21 20:33 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Yang Ruibin @ 2024-08-21 8:39 UTC (permalink / raw)
To: Nuno Sa, Olivier Moysan, Jonathan Cameron, Lars-Peter Clausen,
linux-iio, linux-kernel
Cc: opensource.kernel, Yang Ruibin
The debugfs_create_dir() function returns error pointers.
It never returns NULL. So use IS_ERR() to check it.
Signed-off-by: Yang Ruibin <11162571@vivo.com>
---
drivers/iio/industrialio-backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index a52a6b61c8b5..20b3b5212da7 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -219,7 +219,7 @@ void iio_backend_debugfs_add(struct iio_backend *back,
snprintf(name, sizeof(name), "backend%d", back->idx);
back_d = debugfs_create_dir(name, d);
- if (!back_d)
+ if (IS_ERR(back_d))
return;
if (back->ops->debugfs_reg_access)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
2024-08-21 8:39 [PATCH v1] drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir() Yang Ruibin
@ 2024-08-21 20:33 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-08-21 20:33 UTC (permalink / raw)
To: Yang Ruibin
Cc: Nuno Sa, Olivier Moysan, Lars-Peter Clausen, linux-iio,
linux-kernel, opensource.kernel
On Wed, 21 Aug 2024 04:39:08 -0400
Yang Ruibin <11162571@vivo.com> wrote:
> The debugfs_create_dir() function returns error pointers.
> It never returns NULL. So use IS_ERR() to check it.
>
Applied. Thanks,
Jonathan
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/iio/industrialio-backend.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> index a52a6b61c8b5..20b3b5212da7 100644
> --- a/drivers/iio/industrialio-backend.c
> +++ b/drivers/iio/industrialio-backend.c
> @@ -219,7 +219,7 @@ void iio_backend_debugfs_add(struct iio_backend *back,
> snprintf(name, sizeof(name), "backend%d", back->idx);
>
> back_d = debugfs_create_dir(name, d);
> - if (!back_d)
> + if (IS_ERR(back_d))
> return;
>
> if (back->ops->debugfs_reg_access)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-21 20:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 8:39 [PATCH v1] drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir() Yang Ruibin
2024-08-21 20:33 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox