x86/amd_nb: Check for invalid SMN reads
[linux-block.git] / arch / x86 / kernel / amd_nb.c
index 3cf156f7085917b8e1de4bec7d46b70b2998e1d6..027a8c7a2c9e648996a145befaabe6be457a9cbf 100644 (file)
@@ -215,7 +215,14 @@ out:
 
 int amd_smn_read(u16 node, u32 address, u32 *value)
 {
-       return __amd_smn_rw(node, address, value, false);
+       int err = __amd_smn_rw(node, address, value, false);
+
+       if (PCI_POSSIBLE_ERROR(*value)) {
+               err = -ENODEV;
+               *value = 0;
+       }
+
+       return err;
 }
 EXPORT_SYMBOL_GPL(amd_smn_read);