Skip to contentSkip to conversation

memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'

PATCH Applied Lukasz Luba 2 participants 3 messages Aug 11, 2020 – Aug 17, 2020

Subsystems (3)
lore
Share & tools
lore

Lukasz Luba

author maintainer
#0 lore raw

PATCH 1/1 memory: samsung: exynos5422-dmc: Additional locking for 'curr_rate'

The 'curr_rate' is protected by local 'dmc->lock' in various places, but not in a function exynos5_dmc_get_status(). The lock protects frequency (and voltage) change process and the corresponding value stored in 'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading also in the exynos5_dmc_get_status().

---
 drivers/memory/samsung/exynos5422-dmc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/memory/samsung/exynos5422-dmc.c +3 -0
index b9c7956e5031..952bc61e68f4 100644
@@ -908,7 +908,10 @@ static int exynos5_dmc_get_status(struct device *dev,
 	int ret;
 
 	if (dmc->in_irq_mode) {
+		mutex_lock(&dmc->lock);
 		stat->current_frequency = dmc->curr_rate;
+		mutex_unlock(&dmc->lock);
+
 		stat->busy_time = dmc->load;
 		stat->total_time = dmc->total;
 	} else {
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Lukasz Luba

The 'curr_rate' is protected by local 'dmc->lock' in various places, but not in a function exynos5_dmc_get_status(). The lock protects frequency (and voltage) change process and the corresponding value stored in 'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading also in the exynos5_dmc_get_status().

---
 drivers/memory/samsung/exynos5422-dmc.c | 3 +++

Thanks, applied.

Best regards,
Krzysztof

author maintainer
#2 lore raw

Hi Krzysztof,

Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Lukasz Luba

The 'curr_rate' is protected by local 'dmc->lock' in various places, but not in a function exynos5_dmc_get_status(). The lock protects frequency (and voltage) change process and the corresponding value stored in 'curr_rate'. Add the locking mechanism to protect the 'curr_rate' reading also in the exynos5_dmc_get_status().

Quoted 7 lines
Quoted 4 lines
---
  drivers/memory/samsung/exynos5422-dmc.c | 3 +++

Thanks, applied.

Thank you for applying it.

Regards,
Lukasz