Sasha Levin
2012-Dec-20 19:11 UTC
[PATCH] virtio_console: correct error message on failure of debugfs_create_dir
debugfs_create_dir() returns NULL if it fails, there's little point in
calling PTR_ERR on it.
Signed-off-by: Sasha Levin <sasha.levin at oracle.com>
---
drivers/char/virtio_console.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index c594cb1..490b70e 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2212,10 +2212,9 @@ static int __init init(void)
}
pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
- if (!pdrvdata.debugfs_dir) {
- pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
- PTR_ERR(pdrvdata.debugfs_dir));
- }
+ if (!pdrvdata.debugfs_dir)
+ pr_warn("Error creating debugfs dir for virtio-ports\n");
+
INIT_LIST_HEAD(&pdrvdata.consoles);
INIT_LIST_HEAD(&pdrvdata.portdevs);
--
1.8.0
Amit Shah
2012-Dec-21 07:59 UTC
[PATCH] virtio_console: correct error message on failure of debugfs_create_dir
On (Thu) 20 Dec 2012 [14:11:21], Sasha Levin wrote:> debugfs_create_dir() returns NULL if it fails, there's little point in > calling PTR_ERR on it. > > Signed-off-by: Sasha Levin <sasha.levin at oracle.com> > --- > drivers/char/virtio_console.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c > index c594cb1..490b70e 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -2212,10 +2212,9 @@ static int __init init(void) > } > > pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL); > - if (!pdrvdata.debugfs_dir) { > - pr_warning("Error %ld creating debugfs dir for virtio-ports\n", > - PTR_ERR(pdrvdata.debugfs_dir)); > - } > + if (!pdrvdata.debugfs_dir) > + pr_warn("Error creating debugfs dir for virtio-ports\n");debugfs_create_dir() does return an error value if debugfs is not enabled. This check for !pdrvdata.debugfs_dir should infact use IS_ERR_OR_NULL(). Care to submit a patch for that? Amit
Reasonably Related Threads
- [PATCH] virtio_console: correct error message on failure of debugfs_create_dir
- [patch] virtio: console: fix error handling for debugfs_create_dir()
- [patch] virtio: console: fix error handling for debugfs_create_dir()
- [patch] virtio: console: fix error handling for debugfs_create_dir()
- [patch] virtio: console: fix error handling for debugfs_create_dir()