Commit b2547dce authored by Baolin Wang's avatar Baolin Wang Committed by Bjorn Andersson

hwspinlock: Remove BUG_ON() from the hwspinlock core

The original code use BUG_ON() to validate the parameters when locking
or unlocking one hardware lock, but we should not crash the whole kernel
though the hwlock parameters are incorrect, instead we can return
the error number for users and give some warning.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent b674a30b
...@@ -92,8 +92,8 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags) ...@@ -92,8 +92,8 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
{ {
int ret; int ret;
BUG_ON(!hwlock); if (WARN_ON(!hwlock || (!flags && mode == HWLOCK_IRQSTATE)))
BUG_ON(!flags && mode == HWLOCK_IRQSTATE); return -EINVAL;
/* /*
* This spin_lock{_irq, _irqsave} serves three purposes: * This spin_lock{_irq, _irqsave} serves three purposes:
...@@ -264,8 +264,8 @@ EXPORT_SYMBOL_GPL(__hwspin_lock_timeout); ...@@ -264,8 +264,8 @@ EXPORT_SYMBOL_GPL(__hwspin_lock_timeout);
*/ */
void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags) void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
{ {
BUG_ON(!hwlock); if (WARN_ON(!hwlock || (!flags && mode == HWLOCK_IRQSTATE)))
BUG_ON(!flags && mode == HWLOCK_IRQSTATE); return;
/* /*
* We must make sure that memory operations (both reads and writes), * We must make sure that memory operations (both reads and writes),
......
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