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]
Date:   Tue, 23 Jun 2020 04:51:06 +0200
From:   Andreas Färber <afaerber@...e.de>
To:     linux-realtek-soc@...ts.infradead.org
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        James Tai [戴志峰] 
        <james.tai@...ltek.com>,
        Stanley Chang [昌育德] 
        <stanley_chang@...ltek.com>, Edgar Lee <cylee12@...ltek.com>,
        Andreas Färber <afaerber@...e.de>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH v2 29/29] soc: realtek: chip: Adopt nvmem_cell_read_u8() helper

Replace the local helper with the newly introduced official one.

Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 This could be squashed if the new API and this commit were to get merged in
 subsequent merge windows or with the help of a topic branch.
 
 v2: New
 
 drivers/soc/realtek/chip.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c
index bed028ce1b16..46e0d9063b5d 100644
--- a/drivers/soc/realtek/chip.c
+++ b/drivers/soc/realtek/chip.c
@@ -79,33 +79,6 @@ struct dhc_soc {
 	const char *codename;
 };
 
-static int dhc_efuse_read_u8(struct device *dev, const char *cell_id, u8 *val)
-{
-	struct nvmem_cell *cell;
-	void *buf;
-	size_t len;
-
-	cell = nvmem_cell_get(dev, cell_id);
-	if (IS_ERR(cell))
-		return PTR_ERR(cell);
-
-	buf = nvmem_cell_read(cell, &len);
-	if (IS_ERR(buf)) {
-		nvmem_cell_put(cell);
-		return PTR_ERR(buf);
-	}
-	if (len != sizeof(*val)) {
-		kfree(buf);
-		nvmem_cell_put(cell);
-		return -EINVAL;
-	}
-	memcpy(val, buf, 1);
-	kfree(buf);
-	nvmem_cell_put(cell);
-
-	return 0;
-}
-
 static const char *default_name(struct device *dev, const struct dhc_soc *s)
 {
 	return s->family;
@@ -118,7 +91,7 @@ static const char *rtd1295_name(struct device *dev, const struct dhc_soc *s)
 	int ret;
 	u8 b;
 
-	ret = dhc_efuse_read_u8(dev, "efuse_package_id", &b);
+	ret = nvmem_cell_read_u8(dev, "efuse_package_id", &b);
 	if (ret == -EPROBE_DEFER)
 		return ERR_PTR(ret);
 	else if (ret)
-- 
2.26.2

Powered by blists - more mailing lists