mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg K-H <greg@kroah.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [Patch 2/2] Driver core: Fix cleanup in device_create_vargs().
Date: Wed, 3 Sep 2008 18:26:41 +0200	[thread overview]
Message-ID: <20080903182641.75db23a6@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20080903162808.36bb2405@gondolin.boeblingen.de.ibm.com>

If device_register() in device_create_vargs() fails, the device
must be cleaned up with put_device() (which is also fine on NULL)
instead of kfree().

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>

---
 drivers/base/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/base/core.c
===================================================================
--- linux-2.6.orig/drivers/base/core.c
+++ linux-2.6/drivers/base/core.c
@@ -1248,7 +1248,7 @@ struct device *device_create_vargs(struc
 	return dev;
 
 error:
-	kfree(dev);
+	put_device(dev);
 	return ERR_PTR(retval);
 }
 EXPORT_SYMBOL_GPL(device_create_vargs);

  parent reply	other threads:[~2008-09-03 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080903162808.36bb2405@gondolin.boeblingen.de.ibm.com>
2008-09-03 16:26 ` [Patch 1/2] Driver core: Clarify device cleanup Cornelia Huck
2008-09-03 16:26 ` Cornelia Huck [this message]
2008-09-11 10:11   ` patch driver-core-fix-cleanup-in-device_create_vargs.patch added to gregkh-2.6 tree gregkh

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=20080903182641.75db23a6@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome