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: <20201119114149.4117-48-brgl@bgdev.pl>
Date:   Thu, 19 Nov 2020 12:41:37 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH 47/59] rtc: bq4802: stop using deprecated RTC API

From: Bartosz Golaszewski <bgolaszewski@...libre.com>

devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device()
and devm_rtc_register_device() pair instead.

While at it: remove unnecessary goto label.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
---
 drivers/rtc/rtc-bq4802.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
index 472e75668917..4661dfbddb17 100644
--- a/drivers/rtc/rtc-bq4802.c
+++ b/drivers/rtc/rtc-bq4802.c
@@ -145,16 +145,15 @@ static int bq4802_probe(struct platform_device *pdev)
 	int err = -ENOMEM;
 
 	if (!p)
-		goto out;
+		return err;
 
 	spin_lock_init(&p->lock);
 
 	p->r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!p->r) {
 		p->r = platform_get_resource(pdev, IORESOURCE_IO, 0);
-		err = -EINVAL;
 		if (!p->r)
-			goto out;
+			return -EINVAL;
 	}
 	if (p->r->flags & IORESOURCE_IO) {
 		p->ioport = p->r->start;
@@ -163,29 +162,24 @@ static int bq4802_probe(struct platform_device *pdev)
 	} else if (p->r->flags & IORESOURCE_MEM) {
 		p->regs = devm_ioremap(&pdev->dev, p->r->start,
 					resource_size(p->r));
-		if (!p->regs){
-			err = -ENOMEM;
-			goto out;
-		}
+		if (!p->regs)
+			return -ENOMEM;
+
 		p->read = bq4802_read_mem;
 		p->write = bq4802_write_mem;
 	} else {
-		err = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	platform_set_drvdata(pdev, p);
 
-	p->rtc = devm_rtc_device_register(&pdev->dev, "bq4802",
-					&bq4802_ops, THIS_MODULE);
-	if (IS_ERR(p->rtc)) {
-		err = PTR_ERR(p->rtc);
-		goto out;
-	}
+	p->rtc = devm_rtc_allocate_device(&pdev->dev);
+	if (IS_ERR(p->rtc))
+		return PTR_ERR(p->rtc);
+
+	p->rtc->ops = &bq4802_ops;
 
-	err = 0;
-out:
-	return err;
+	return devm_rtc_register_device(p->rtc);
 
 }
 
-- 
2.29.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ