lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200508131338.32956-1-bernard@vivo.com>
Date:   Fri,  8 May 2020 06:13:38 -0700
From:   Bernard Zhao <bernard@...o.com>
To:     Lukasz Luba <lukasz.luba@....com>, Kukjin Kim <kgene@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        linux-pm@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     opensource.kernel@...o.com, Bernard Zhao <bernard@...o.com>
Subject: [PATCH] memory/samsung: reduce unnecessary mutex lock area

Maybe dmc->df->lock is unnecessary to protect function
exynos5_dmc_perf_events_check(dmc). If we have to protect,
dmc->lock is more better and more effective.
Also, it seems not needed to protect "if (ret) & dev_warn"
branch.

Signed-off-by: Bernard Zhao <bernard@...o.com>
---
 drivers/memory/samsung/exynos5422-dmc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c
index 22a43d662833..88e8ac8b5327 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -1345,16 +1345,14 @@ static irqreturn_t dmc_irq_thread(int irq, void *priv)
 	int res;
 	struct exynos5_dmc *dmc = priv;
 
-	mutex_lock(&dmc->df->lock);
-
 	exynos5_dmc_perf_events_check(dmc);
 
+	mutex_lock(&dmc->df->lock);
 	res = update_devfreq(dmc->df);
+	mutex_unlock(&dmc->df->lock);
 	if (res)
 		dev_warn(dmc->dev, "devfreq failed with %d\n", res);
 
-	mutex_unlock(&dmc->df->lock);
-
 	return IRQ_HANDLED;
 }
 
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ