public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: mcheck: call put_device on device_register failure
@ 2013-11-29 20:28 Levente Kurusa
  2013-11-29 20:56 ` Borislav Petkov
  0 siblings, 1 reply; 15+ messages in thread
From: Levente Kurusa @ 2013-11-29 20:28 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Tony Luck, Borislav Petkov,
	H. Peter Anvin
  Cc: x86, EDAC, LKML

This patch adds a call to put_device() when the device_register()
call has failed. This is required so that the last reference to the
device is given up.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b3218cd..a389c1d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2272,8 +2272,10 @@ static int mce_device_create(unsigned int cpu)
 	dev->release = &mce_device_release;

 	err = device_register(dev);
-	if (err)
+	if (err) {
+		put_device(dev);
 		return err;
+	}

 	for (i = 0; mce_device_attrs[i]; i++) {
 		err = device_create_file(dev, mce_device_attrs[i]);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-12-05 11:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29 20:28 [PATCH] x86: mcheck: call put_device on device_register failure Levente Kurusa
2013-11-29 20:56 ` Borislav Petkov
2013-11-30  7:30   ` Levente Kurusa
2013-11-30 11:12     ` Borislav Petkov
2013-11-30 11:25       ` Levente Kurusa
2013-11-30 11:32         ` Borislav Petkov
2013-11-30 11:44           ` Levente Kurusa
2013-11-30 12:08             ` Borislav Petkov
2013-11-30 12:37               ` Levente Kurusa
2013-12-03  2:23       ` Chen, Gong
2013-12-03 17:01         ` Borislav Petkov
2013-12-04  7:38           ` Chen, Gong
2013-12-04 18:39             ` Levente Kurusa
2013-12-05  2:57               ` Chen, Gong
2013-12-05 11:18                 ` Levente Kurusa

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