drivers/thermal/testing/zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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/thermal/testing/zone.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c
index fcee12b152da..26f0f80a6a5d 100644
--- a/drivers/thermal/testing/zone.c
+++ b/drivers/thermal/testing/zone.c
@@ -167,7 +167,7 @@ static void tt_add_tz_work_fn(struct work_struct *work)
snprintf(f_name, TT_MAX_FILE_NAME_LENGTH, "tz%d", tt_zone->id);
tt_zone->d_tt_zone = debugfs_create_dir(f_name, d_testing);
- if (!tt_zone->d_tt_zone) {
+ if (IS_ERR(tt_zone->d_tt_zone)) {
tt_zone_free(tt_zone);
return;
}
--
2.34.1
On Thu, Aug 22, 2024 at 4:59 AM 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.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/thermal/testing/zone.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c
> index fcee12b152da..26f0f80a6a5d 100644
> --- a/drivers/thermal/testing/zone.c
> +++ b/drivers/thermal/testing/zone.c
> @@ -167,7 +167,7 @@ static void tt_add_tz_work_fn(struct work_struct *work)
>
> snprintf(f_name, TT_MAX_FILE_NAME_LENGTH, "tz%d", tt_zone->id);
> tt_zone->d_tt_zone = debugfs_create_dir(f_name, d_testing);
> - if (!tt_zone->d_tt_zone) {
> + if (IS_ERR(tt_zone->d_tt_zone)) {
> tt_zone_free(tt_zone);
> return;
> }
> --
Thanks for catching this, but I'll just redo the patch while it is still fresh.
On Thu, Aug 22, 2024 at 11:43 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Aug 22, 2024 at 4:59 AM 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.
> >
> > Signed-off-by: Yang Ruibin <11162571@vivo.com>
> > ---
> > drivers/thermal/testing/zone.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/testing/zone.c b/drivers/thermal/testing/zone.c
> > index fcee12b152da..26f0f80a6a5d 100644
> > --- a/drivers/thermal/testing/zone.c
> > +++ b/drivers/thermal/testing/zone.c
> > @@ -167,7 +167,7 @@ static void tt_add_tz_work_fn(struct work_struct *work)
> >
> > snprintf(f_name, TT_MAX_FILE_NAME_LENGTH, "tz%d", tt_zone->id);
> > tt_zone->d_tt_zone = debugfs_create_dir(f_name, d_testing);
> > - if (!tt_zone->d_tt_zone) {
> > + if (IS_ERR(tt_zone->d_tt_zone)) {
> > tt_zone_free(tt_zone);
> > return;
> > }
> > --
>
> Thanks for catching this, but I'll just redo the patch while it is still fresh.
BTW, which tree is this patch against?
This issue has been addressed in my linux-next branch already AFAICS.
© 2016 - 2026 Red Hat, Inc.