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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821181235.22270-2-martin@kaiser.cx>
Date: Wed, 21 Aug 2024 20:12:34 +0200
From: Martin Kaiser <martin@...ser.cx>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Aurelien Jarno <aurelien@...el32.net>,
	Daniel Golle <daniel@...rotopia.org>,
	linux-crypto@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Martin Kaiser <martin@...ser.cx>
Subject: [PATCH 1/2] hwrng: rockchip - rst is used only during probe

The driver uses the rst variable only for an initial reset when the chip
is probed. There's no need to store rst in the driver's private data, we
can make it a local variable in the probe function.

Signed-off-by: Martin Kaiser <martin@...ser.cx>
---
 drivers/char/hw_random/rockchip-rng.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/char/hw_random/rockchip-rng.c b/drivers/char/hw_random/rockchip-rng.c
index 548e2f4d1490..0dff9de64bc5 100644
--- a/drivers/char/hw_random/rockchip-rng.c
+++ b/drivers/char/hw_random/rockchip-rng.c
@@ -52,7 +52,6 @@
 struct rk_rng {
 	struct hwrng rng;
 	void __iomem *base;
-	struct reset_control *rst;
 	int clk_num;
 	struct clk_bulk_data *clk_bulks;
 };
@@ -132,6 +131,7 @@ static int rk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
 static int rk_rng_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct reset_control *rst;
 	struct rk_rng *rk_rng;
 	int ret;
 
@@ -148,14 +148,13 @@ static int rk_rng_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, rk_rng->clk_num,
 				     "Failed to get clks property\n");
 
-	rk_rng->rst = devm_reset_control_array_get_exclusive(&pdev->dev);
-	if (IS_ERR(rk_rng->rst))
-		return dev_err_probe(dev, PTR_ERR(rk_rng->rst),
-				     "Failed to get reset property\n");
+	rst = devm_reset_control_array_get_exclusive(&pdev->dev);
+	if (IS_ERR(rst))
+		return dev_err_probe(dev, PTR_ERR(rst), "Failed to get reset property\n");
 
-	reset_control_assert(rk_rng->rst);
+	reset_control_assert(rst);
 	udelay(2);
-	reset_control_deassert(rk_rng->rst);
+	reset_control_deassert(rst);
 
 	platform_set_drvdata(pdev, rk_rng);
 
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ