Skip to content

Commit

Permalink
x86, mce: Call put_device on device_register failure
Browse files Browse the repository at this point in the history
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>
Link: http://lkml.kernel.org/r/5298F900.9000208@linux.com
Signed-off-by: Borislav Petkov <bp@suse.de>
  • Loading branch information
Levente Kurusa authored and Borislav Petkov committed Nov 30, 2013
1 parent dc1ccc4 commit 853d9b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kernel/cpu/mcheck/mce.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 853d9b1

Please sign in to comment.