Commit aee530cf authored by Guenter Roeck's avatar Guenter Roeck Committed by Matt Fleming

firmware: Do not use WARN_ON(!spin_is_locked())

spin_is_locked() always returns false for uniprocessor configurations
in several architectures, so do not use WARN_ON with it.
Use lockdep_assert_held() instead to also reduce overhead in
non-debug kernels.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent 7d1311b9
...@@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove); ...@@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove);
*/ */
static void efivar_entry_list_del_unlock(struct efivar_entry *entry) static void efivar_entry_list_del_unlock(struct efivar_entry *entry)
{ {
WARN_ON(!spin_is_locked(&__efivars->lock)); lockdep_assert_held(&__efivars->lock);
list_del(&entry->list); list_del(&entry->list);
spin_unlock_irq(&__efivars->lock); spin_unlock_irq(&__efivars->lock);
...@@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_entry *entry) ...@@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_entry *entry)
const struct efivar_operations *ops = __efivars->ops; const struct efivar_operations *ops = __efivars->ops;
efi_status_t status; efi_status_t status;
WARN_ON(!spin_is_locked(&__efivars->lock)); lockdep_assert_held(&__efivars->lock);
status = ops->set_variable(entry->var.VariableName, status = ops->set_variable(entry->var.VariableName,
&entry->var.VendorGuid, &entry->var.VendorGuid,
...@@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, ...@@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
int strsize1, strsize2; int strsize1, strsize2;
bool found = false; bool found = false;
WARN_ON(!spin_is_locked(&__efivars->lock)); lockdep_assert_held(&__efivars->lock);
list_for_each_entry_safe(entry, n, head, list) { list_for_each_entry_safe(entry, n, head, list) {
strsize1 = ucs2_strsize(name, 1024); strsize1 = ucs2_strsize(name, 1024);
...@@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, ...@@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
const struct efivar_operations *ops = __efivars->ops; const struct efivar_operations *ops = __efivars->ops;
efi_status_t status; efi_status_t status;
WARN_ON(!spin_is_locked(&__efivars->lock)); lockdep_assert_held(&__efivars->lock);
status = ops->get_variable(entry->var.VariableName, status = ops->get_variable(entry->var.VariableName,
&entry->var.VendorGuid, &entry->var.VendorGuid,
......
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