mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
regmap: Also protect hwspinlock in error handling path
The previous patch to allow the hwspinlock code to be disabled missed handling the free in the error path, do so using the better IS_ENABLED() pattern as suggested by Baolin. While we're at it also check that we have a hardware spinlock before freeing it - the core code reports an error when freeing an invalid lock. Suggested-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
f25637a6b8
commit
267f3e4f18
1 changed files with 2 additions and 1 deletions
|
@ -1116,7 +1116,8 @@ struct regmap *__regmap_init(struct device *dev,
|
|||
regmap_range_exit(map);
|
||||
kfree(map->work_buf);
|
||||
err_hwlock:
|
||||
hwspin_lock_free(map->hwlock);
|
||||
if (IS_ENABLED(REGMAP_HWSPINLOCK) && map->hwlock)
|
||||
hwspin_lock_free(map->hwlock);
|
||||
err_map:
|
||||
kfree(map);
|
||||
err:
|
||||
|
|
Loading…
Reference in a new issue