All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] More Driver Core patches for 2.6.10-rc1
Date: Fri, 12 Nov 2004 15:00:06 -0800	[thread overview]
Message-ID: <11003004062835@kroah.com> (raw)
In-Reply-To: <1100300406618@kroah.com>

ChangeSet 1.2094, 2004/11/12 11:42:03-08:00, miltonm@bga.com

[PATCH] fix sysfs backing store error path confusion

On Nov 3, 2004, at 3:42 PM, Greg KH wrote:

|On Tue, Nov 02, 2004 at 10:03:34AM -0600, Maneesh Soni wrote:
||On Tue, Nov 02, 2004 at 02:46:58AM -0600, Milton Miller wrote:
|||sysfs_new_dirent returns ERR_PTR(-ENOMEM) if kmalloc fails but the callers
|||were expecting NULL.
||
||Thanks for spotting this. But as you said, I will prefer to change the callee.
||How about this patch?
..
||-		return -ENOMEM;
||+		return NULL;
|
|Actually, this needs to be a 0, not NULL, otherwise the compiler
|complains with a warning.  I've fixed it up and applied it.
|
|thanks,
|
|greg k-h

I wondered why greg thought the type was wrong.   After it was merged I
realized that the wrong function was changed.  Here's an attempt to fix
both errors.


Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 fs/sysfs/dir.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c	2004-11-12 14:53:33 -08:00
+++ b/fs/sysfs/dir.c	2004-11-12 14:53:33 -08:00
@@ -38,7 +38,7 @@
 
 	sd = kmalloc(sizeof(*sd), GFP_KERNEL);
 	if (!sd)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 
 	memset(sd, 0, sizeof(*sd));
 	atomic_set(&sd->s_count, 1);
@@ -56,7 +56,7 @@
 
 	sd = sysfs_new_dirent(parent_sd, element);
 	if (!sd)
-		return 0;
+		return -ENOMEMurn -ENOMEM;
 
 	sd->s_mode = mode;
 	sd->s_type = type;


  reply	other threads:[~2004-11-12 23:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-12 22:58 [BK PATCH] More Driver Core patches for 2.6.10-rc1 Greg KH
2004-11-12 23:00 ` [PATCH] " Greg KH
2004-11-12 23:00   ` Greg KH [this message]
2004-11-12 23:00     ` Greg KH
2004-11-12 23:00       ` Greg KH
2004-11-12 23:00         ` Greg KH
2004-11-12 23:00           ` Greg KH
2004-11-12 23:00             ` Greg KH
2004-11-12 23:00               ` Greg KH
2004-11-12 23:00                 ` Greg KH
     [not found]     ` <20041113000052.GC346@electric-eye.fr.zoreil.com>
     [not found]       ` <200411130020.17494.lists@kenneth.aafloy.net>
2004-11-13  0:44         ` Greg KH
2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds
2004-11-13 21:10   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05  0:35 [BK PATCH] More USB " Greg KH
2004-11-05  0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05  0:48   ` Greg KH
2004-11-05  0:48     ` Greg KH
2004-11-05  0:48       ` Greg KH
2004-11-05  0:48         ` Greg KH
2004-11-05  0:48           ` Greg KH
2004-11-05  0:48             ` Greg KH
2004-11-05  0:48               ` Greg KH
2004-11-05  0:48                 ` Greg KH
2004-11-05  0:48                   ` Greg KH
2004-11-05  0:48                     ` Greg KH
2004-11-05  0:48                       ` Greg KH

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=11003004062835@kroah.com \
    --to=greg@kroah.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.