public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Error in ERR_PTR usage
@ 2005-03-20  6:56 Yum Rayan
  0 siblings, 0 replies; only message in thread
From: Yum Rayan @ 2005-03-20  6:56 UTC (permalink / raw)
  To: linux-kernel

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-20  6:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-20  6:56 [PATCH] Error in ERR_PTR usage Yum Rayan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox