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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 10 Apr 2019 09:27:43 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Wim Van Sebroeck <wim@...ux-watchdog.org>
Cc:     linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
        Guenter Roeck <linux@...ck-us.net>
Subject: [PATCH 02/22] watchdog: tqmx86_wdt: Use 'dev' instead of dereferencing it repeatedly

Introduce local variable 'struct device *dev' and use it instead of
dereferencing it repeatedly.

The conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
 drivers/watchdog/tqmx86_wdt.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/tqmx86_wdt.c b/drivers/watchdog/tqmx86_wdt.c
index 52941207a12a..72d0b0adde38 100644
--- a/drivers/watchdog/tqmx86_wdt.c
+++ b/drivers/watchdog/tqmx86_wdt.c
@@ -70,11 +70,12 @@ static struct watchdog_ops tqmx86_wdt_ops = {
 
 static int tqmx86_wdt_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct tqmx86_wdt *priv;
 	struct resource *res;
 	int err;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
@@ -82,14 +83,13 @@ static int tqmx86_wdt_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	priv->io_base = devm_ioport_map(&pdev->dev, res->start,
-					resource_size(res));
+	priv->io_base = devm_ioport_map(dev, res->start, resource_size(res));
 	if (!priv->io_base)
 		return -ENOMEM;
 
 	watchdog_set_drvdata(&priv->wdd, priv);
 
-	priv->wdd.parent = &pdev->dev;
+	priv->wdd.parent = dev;
 	priv->wdd.info = &tqmx86_wdt_info;
 	priv->wdd.ops = &tqmx86_wdt_ops;
 	priv->wdd.min_timeout = 1;
@@ -97,16 +97,16 @@ static int tqmx86_wdt_probe(struct platform_device *pdev)
 	priv->wdd.max_hw_heartbeat_ms = 4096*1000;
 	priv->wdd.timeout = WDT_TIMEOUT;
 
-	watchdog_init_timeout(&priv->wdd, timeout, &pdev->dev);
+	watchdog_init_timeout(&priv->wdd, timeout, dev);
 	watchdog_set_nowayout(&priv->wdd, WATCHDOG_NOWAYOUT);
 
 	tqmx86_wdt_set_timeout(&priv->wdd, priv->wdd.timeout);
 
-	err = devm_watchdog_register_device(&pdev->dev, &priv->wdd);
+	err = devm_watchdog_register_device(dev, &priv->wdd);
 	if (err)
 		return err;
 
-	dev_info(&pdev->dev, "TQMx86 watchdog\n");
+	dev_info(dev, "TQMx86 watchdog\n");
 
 	return 0;
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ