From: James Bottomley <James.Bottomley@suse.de>
To: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] enclosure: fix error path - actually return ERR_PTR() on error
Date: Fri, 12 Mar 2010 16:14:42 -0600 [thread overview]
Message-ID: <1268432082.2802.401.camel@mulgrave.site> (raw)
In-Reply-To: <1268401858-9213-1-git-send-email-ext-jani.1.nikula@nokia.com>
On Fri, 2010-03-12 at 15:50 +0200, Jani Nikula wrote:
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> ---
>
> NOTE: I'm afraid I'm unable to test this; please consider this more a
> bug report than a complete patch.
It's a good bug report, thanks. It looks like there's an unreleased
cdev pointer along that path too, so this should be the final fix.
James
---
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 1eac626..68e4cd7 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -284,8 +284,11 @@ enclosure_component_register(struct enclosure_device *edev,
cdev->groups = enclosure_groups;
err = device_register(cdev);
- if (err)
- ERR_PTR(err);
+ if (err) {
+ ecomp->number = -1;
+ put_device(cdev);
+ return ERR_PTR(err);
+ }
return ecomp;
}
parent reply other threads:[~2010-03-12 23:24 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1268401858-9213-1-git-send-email-ext-jani.1.nikula@nokia.com>]
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=1268432082.2802.401.camel@mulgrave.site \
--to=james.bottomley@suse.de \
--cc=akpm@linux-foundation.org \
--cc=ext-jani.1.nikula@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox