Commit ec553abb authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Thomas Gleixner

x86/mcheck: Explicit cleanup on failure in mce_amd

If the ONLINE callback fails, the driver does not any clean up right
away instead it waits to get to the DEAD stage to do it. Yes, it waits.
Since we don't pass the error code back to the caller, no one knows.

Do the clean up right away so it does not look like a leak.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: rt@linutronix.de
Cc: linux-edac@vger.kernel.org
Link: http://lkml.kernel.org/r/20161110174447.11848-3-bigeasy@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 09436372
...@@ -1087,6 +1087,7 @@ static void threshold_remove_device(unsigned int cpu) ...@@ -1087,6 +1087,7 @@ static void threshold_remove_device(unsigned int cpu)
threshold_remove_bank(cpu, bank); threshold_remove_bank(cpu, bank);
} }
kfree(per_cpu(threshold_banks, cpu)); kfree(per_cpu(threshold_banks, cpu));
per_cpu(threshold_banks, cpu) = NULL;
} }
/* create dir/files for all valid threshold banks */ /* create dir/files for all valid threshold banks */
...@@ -1108,9 +1109,11 @@ static int threshold_create_device(unsigned int cpu) ...@@ -1108,9 +1109,11 @@ static int threshold_create_device(unsigned int cpu)
continue; continue;
err = threshold_create_bank(cpu, bank); err = threshold_create_bank(cpu, bank);
if (err) if (err)
return err; goto err;
} }
return err;
err:
threshold_remove_device(cpu);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment