From: Yum Rayan <yum.rayan@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Error in ERR_PTR usage
Date: Sat, 19 Mar 2005 22:56:37 -0800 [thread overview]
Message-ID: <df35dfeb05031922561284add0@mail.gmail.com> (raw)
Was trying to understand ERR_PTR and friends and surprisingly the
first 2 references via LXR seem to be erroneous. Did grep and found 1
additional incorrect reference "return ERR_PTR(0)" and another
"ERR_PTR(PTR_ERR(p))" usage. Please let me know if this patch is good.
If need be, I can chop it up for the individual maintainers, but it
would be nice if someone can comment first.
Thanks,
Rayan
Signed-off-by: Yum Rayan <yum.rayan@gmail.com>
diff -Nur linux-2.6.11.5.orig/drivers/video/backlight/backlight.c
linux-2.6.11.5/drivers/video/backlight/backlight.c
--- linux-2.6.11.5.orig/drivers/video/backlight/backlight.c 2005-03-18
22:34:50.000000000 -0800
+++ linux-2.6.11.5/drivers/video/backlight/backlight.c 2005-03-19
22:21:45.058128838 -0800
@@ -174,7 +174,7 @@
new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL);
if (unlikely(!new_bd))
- return ERR_PTR(ENOMEM);
+ return ERR_PTR(-ENOMEM);
init_MUTEX(&new_bd->sem);
new_bd->props = bp;
diff -Nur linux-2.6.11.5.orig/drivers/video/backlight/lcd.c
linux-2.6.11.5/drivers/video/backlight/lcd.c
--- linux-2.6.11.5.orig/drivers/video/backlight/lcd.c 2005-03-18
22:35:04.000000000 -0800
+++ linux-2.6.11.5/drivers/video/backlight/lcd.c 2005-03-19
22:22:02.923823575 -0800
@@ -173,7 +173,7 @@
new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL);
if (unlikely(!new_ld))
- return ERR_PTR(ENOMEM);
+ return ERR_PTR(-ENOMEM);
init_MUTEX(&new_ld->sem);
new_ld->props = lp;
diff -Nur linux-2.6.11.5.orig/fs/jfs/namei.c linux-2.6.11.5/fs/jfs/namei.c
--- linux-2.6.11.5.orig/fs/jfs/namei.c 2005-03-18 22:35:07.000000000 -0800
+++ linux-2.6.11.5/fs/jfs/namei.c 2005-03-19 22:26:52.156692285 -0800
@@ -1420,7 +1420,7 @@
free_UCSname(&key);
if (rc == -ENOENT) {
d_add(dentry, NULL);
- return ERR_PTR(0);
+ return ERR_PTR(-ENOENT);
} else if (rc) {
jfs_err("jfs_lookup: dtSearch returned %d", rc);
return ERR_PTR(rc);
diff -Nur linux-2.6.11.5.orig/fs/reiserfs/xattr.c
linux-2.6.11.5/fs/reiserfs/xattr.c
--- linux-2.6.11.5.orig/fs/reiserfs/xattr.c 2005-03-18 22:35:04.000000000 -0800
+++ linux-2.6.11.5/fs/reiserfs/xattr.c 2005-03-19 22:26:13.997480188 -0800
@@ -200,7 +200,7 @@
xadir = open_xa_dir (inode, flags);
if (IS_ERR (xadir)) {
- return ERR_PTR (PTR_ERR (xadir));
+ return xadir;
} else if (xadir && !xadir->d_inode) {
dput (xadir);
return ERR_PTR (-ENODATA);
@@ -209,7 +209,7 @@
xafile = lookup_one_len (name, xadir, strlen (name));
if (IS_ERR (xafile)) {
dput (xadir);
- return ERR_PTR (PTR_ERR (xafile));
+ return xafile;
}
if (xafile->d_inode) { /* file exists */
@@ -251,7 +251,7 @@
xafile = get_xa_file_dentry (inode, name, flags);
if (IS_ERR (xafile))
- return ERR_PTR (PTR_ERR (xafile));
+ return xafile;
else if (!xafile->d_inode) {
dput (xafile);
return ERR_PTR (-ENODATA);
reply other threads:[~2005-03-20 6:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df35dfeb05031922561284add0@mail.gmail.com \
--to=yum.rayan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.