regmap: Also protect hwspinlock in error handling path
authorMark Brown <broonie@kernel.org>
Fri, 3 Nov 2017 19:50:20 +0000 (19:50 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 3 Nov 2017 19:53:42 +0000 (19:53 +0000)
commit267f3e4f18f1ccf9e8cf72c3b4689df03025516d
treebe877c167170dde39be2493be750dbfb4a08efc5
parentf25637a6b89e59eddf79f6df39b23e202753f555
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>
drivers/base/regmap/regmap.c