* [PATCH 1/2] regmap: Also protect hwspinlock in error handling path
@ 2017-11-03 20:08 Mark Brown
2017-11-03 20:08 ` [PATCH 2/2] regmap: Clean up hwspinlock on regmap exit Mark Brown
2017-11-03 20:17 ` Applied "regmap: Also protect hwspinlock in error handling path" " Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2017-11-03 20:08 UTC (permalink / raw)
To: Baolin Wang; +Cc: linux-kernel, Mark Brown
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ff6ef6a579c6..5ff549fa880b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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:
--
2.15.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] regmap: Clean up hwspinlock on regmap exit
2017-11-03 20:08 [PATCH 1/2] regmap: Also protect hwspinlock in error handling path Mark Brown
@ 2017-11-03 20:08 ` Mark Brown
2017-11-03 20:17 ` Applied "regmap: Clean up hwspinlock on regmap exit" to the regmap tree Mark Brown
2017-11-03 20:17 ` Applied "regmap: Also protect hwspinlock in error handling path" " Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2017-11-03 20:08 UTC (permalink / raw)
To: Baolin Wang; +Cc: linux-kernel, Mark Brown
We should free any hwspinlocks when we destroy the regmap, do so.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/base/regmap/regmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 5ff549fa880b..bfe2f250d011 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1305,6 +1305,8 @@ void regmap_exit(struct regmap *map)
kfree(async->work_buf);
kfree(async);
}
+ if (IS_ENABLED(REGMAP_HWSPINLOCK) && map->hwlock)
+ hwspin_lock_free(map->hwlock);
kfree(map);
}
EXPORT_SYMBOL_GPL(regmap_exit);
--
2.15.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Applied "regmap: Clean up hwspinlock on regmap exit" to the regmap tree
2017-11-03 20:08 ` [PATCH 2/2] regmap: Clean up hwspinlock on regmap exit Mark Brown
@ 2017-11-03 20:17 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2017-11-03 20:17 UTC (permalink / raw)
To: Mark Brown; +Cc: Baolin Wang, linux-kernel, linux-kernel
The patch
regmap: Clean up hwspinlock on regmap exit
has been applied to the regmap tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From e8419c40a5ad58eaa112173f554148accc6794f3 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Fri, 3 Nov 2017 19:53:56 +0000
Subject: [PATCH] regmap: Clean up hwspinlock on regmap exit
We should free any hwspinlocks when we destroy the regmap, do so.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/base/regmap/regmap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 5ff549fa880b..bfe2f250d011 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1305,6 +1305,8 @@ void regmap_exit(struct regmap *map)
kfree(async->work_buf);
kfree(async);
}
+ if (IS_ENABLED(REGMAP_HWSPINLOCK) && map->hwlock)
+ hwspin_lock_free(map->hwlock);
kfree(map);
}
EXPORT_SYMBOL_GPL(regmap_exit);
--
2.15.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Applied "regmap: Also protect hwspinlock in error handling path" to the regmap tree
2017-11-03 20:08 [PATCH 1/2] regmap: Also protect hwspinlock in error handling path Mark Brown
2017-11-03 20:08 ` [PATCH 2/2] regmap: Clean up hwspinlock on regmap exit Mark Brown
@ 2017-11-03 20:17 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2017-11-03 20:17 UTC (permalink / raw)
To: Mark Brown; +Cc: Baolin Wang, linux-kernel, linux-kernel
The patch
regmap: Also protect hwspinlock in error handling path
has been applied to the regmap tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 267f3e4f18f1ccf9e8cf72c3b4689df03025516d Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Fri, 3 Nov 2017 19:50:20 +0000
Subject: [PATCH] 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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ff6ef6a579c6..5ff549fa880b 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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:
--
2.15.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-03 20:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-03 20:08 [PATCH 1/2] regmap: Also protect hwspinlock in error handling path Mark Brown
2017-11-03 20:08 ` [PATCH 2/2] regmap: Clean up hwspinlock on regmap exit Mark Brown
2017-11-03 20:17 ` Applied "regmap: Clean up hwspinlock on regmap exit" to the regmap tree Mark Brown
2017-11-03 20:17 ` Applied "regmap: Also protect hwspinlock in error handling path" " Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome