lkml.org 
[lkml]   [2005]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Error in ERR_PTR usage
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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:11    [W:0.027 / U:22.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site