[PATCH] powerpc: fix debugfs_create_dir error checking
Immad Mir
mirimmad17 at gmail.com
Sun May 28 18:06:48 AEST 2023
> Why is this driver caring if debugfs is working or not at all? It
> should just ignore the error and keep moving forward.
I do not know. But, if the authors of the driver have decided to check for
the error, maybe use the more appropriate way?
Thanks.
Immad.
On Sun, May 28, 2023 at 1:27 PM Greg KH <gregkh at linuxfoundation.org> wrote:
> On Sun, May 28, 2023 at 01:16:44PM +0530, mirimmad at outlook.com wrote:
> > From: Immad Mir <mirimmad17 at gmail.com>
> >
> > The debugfs_create_dir returns ERR_PTR incase of an error and the
> > correct way of checking it by using the IS_ERR inline function, and
> > not the simple null comparision. This patch fixes this.
> >
> > Suggested-By: Ivan Orlov <ivan.orlov0322 at gmail.com>
> > Signed-off-by: Immad Mir <mirimmad17 at gmail.com>
> > ---
> > arch/powerpc/platforms/powernv/opal-xscom.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c
> b/arch/powerpc/platforms/powernv/opal-xscom.c
> > index 6b4eed2ef..262cd6fac 100644
> > --- a/arch/powerpc/platforms/powernv/opal-xscom.c
> > +++ b/arch/powerpc/platforms/powernv/opal-xscom.c
> > @@ -168,7 +168,7 @@ static int scom_debug_init_one(struct dentry *root,
> struct device_node *dn,
> > ent->path.size = strlen((char *)ent->path.data);
> >
> > dir = debugfs_create_dir(ent->name, root);
> > - if (!dir) {
> > + if (IS_ERR(dir)) {
> > kfree(ent->path.data);
> > kfree(ent);
> > return -1;
>
> Why is this driver caring if debugfs is working or not at all? It
> should just ignore the error and keep moving forward.
>
> And -1 is not a valid error number :(
>
> Have you hit this error on this driver?
>
> thanks,
>
> greg k-h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20230528/6b84b8d0/attachment.htm>
More information about the Linuxppc-dev
mailing list