Skip to content

Commit

Permalink
hwspinlock/core: use global ID to register hwspinlocks on multiple de…
Browse files Browse the repository at this point in the history
…vices

Commit 300bab9 (hwspinlock/core: register a bank of hwspinlocks in a
single API call, 2011-09-06) introduced 'hwspin_lock_register_single()'
to register numerous (a bank of) hwspinlock instances in a single API,
'hwspin_lock_register()'.

At which time, 'hwspin_lock_register()' accidentally passes 'local IDs'
to 'hwspin_lock_register_single()', despite that ..._single() requires
'global IDs' to register hwspinlocks.

We have to convert into global IDs by supplying the missing 'base_id'.

Cc: stable <[email protected]>
Signed-off-by: Shinya Kuribayashi <[email protected]>
[ohad: fix error path of hwspin_lock_register, too]
Signed-off-by: Ohad Ben-Cohen <[email protected]>
  • Loading branch information
Shinya Kuribayashi authored and ohadbc committed Jul 7, 2012
1 parent 6887a41 commit 476a7ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hwspinlock/hwspinlock_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,
spin_lock_init(&hwlock->lock);
hwlock->bank = bank;

ret = hwspin_lock_register_single(hwlock, i);
ret = hwspin_lock_register_single(hwlock, base_id + i);
if (ret)
goto reg_failed;
}
Expand All @@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev,

reg_failed:
while (--i >= 0)
hwspin_lock_unregister_single(i);
hwspin_lock_unregister_single(base_id + i);
return ret;
}
EXPORT_SYMBOL_GPL(hwspin_lock_register);
Expand Down

0 comments on commit 476a7ee

Please sign in to comment.