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>] [day] [month] [year] [list]
Message-ID: <945b113c-516d-4d35-9d45-224c03a344e4@web.de>
Date: Fri, 15 Nov 2024 13:45:56 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-hwmon@...r.kernel.org, openbmc@...ts.ozlabs.org,
 Avi Fishman <avifishman70@...il.com>, Benjamin Fair
 <benjaminfair@...gle.com>, Günter Röck
 <linux@...ck-us.net>, Jean Delvare <jdelvare@...e.com>,
 Nancy Yuen <yuenn@...gle.com>, Patrick Venture <venture@...gle.com>,
 Tali Perry <tali.perry1@...il.com>, Tomer Maimon <tmaimon77@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Rosen Penev <rosenp@...il.com>
Subject: [PATCH] hwmon: (npcm750-pwm-fan) Use
 devm_platform_ioremap_resource_byname() in npcm7xx_pwm_fan_probe()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 15 Nov 2024 13:30:58 +0100

* Reuse existing functionality from devm_platform_ioremap_resource_byname()
  instead of keeping duplicate source code.

  This issue was transformed by using the Coccinelle software.

* Omit the local variable “res” which became unnecessary
  with this refactoring.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/hwmon/npcm750-pwm-fan.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c
index db3b551828eb..d66edb184bca 100644
--- a/drivers/hwmon/npcm750-pwm-fan.c
+++ b/drivers/hwmon/npcm750-pwm-fan.c
@@ -929,7 +929,6 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np;
 	struct npcm7xx_pwm_fan_data *data;
-	struct resource *res;
 	struct device *hwmon;
 	char name[20];
 	int ret, cnt;
@@ -948,14 +947,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)

 	data->pwm_modules = data->info->pwm_max_channel / NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE;

-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm");
-	if (!res) {
-		dev_err(dev, "pwm resource not found\n");
-		return -ENODEV;
-	}
-
-	data->pwm_base = devm_ioremap_resource(dev, res);
-	dev_dbg(dev, "pwm base resource is %pR\n", res);
+	data->pwm_base = devm_platform_ioremap_resource_byname(pdev, "pwm");
 	if (IS_ERR(data->pwm_base))
 		return PTR_ERR(data->pwm_base);

@@ -965,14 +957,7 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
 		return PTR_ERR(data->pwm_clk);
 	}

-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fan");
-	if (!res) {
-		dev_err(dev, "fan resource not found\n");
-		return -ENODEV;
-	}
-
-	data->fan_base = devm_ioremap_resource(dev, res);
-	dev_dbg(dev, "fan base resource is %pR\n", res);
+	data->fan_base = devm_platform_ioremap_resource_byname(pdev, "fan");
 	if (IS_ERR(data->fan_base))
 		return PTR_ERR(data->fan_base);

--
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ