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: <20180323105017.GI3417@piout.net>
Date:   Fri, 23 Mar 2018 11:50:17 +0100
From:   Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To:     sean.wang@...iatek.com
Cc:     robh+dt@...nel.org, mark.rutland@....com, sre@...nel.org,
        lee.jones@...aro.org, a.zummo@...ertech.it,
        eddie.huang@...iatek.com, devicetree@...r.kernel.org,
        linux-rtc@...r.kernel.org, linux-pm@...r.kernel.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 09/16] rtc: mediatek: convert to use device managed
 functions

On 23/03/2018 at 17:15:06 +0800, sean.wang@...iatek.com wrote:
> From: Sean Wang <sean.wang@...iatek.com>
> 
> Use device managed operation to simplify error handling, reduce source
> code size, and reduce the likelyhood of bugs, and remove our removal
> callback which contains anything already done by device managed functions.
> 
> Signed-off-by: Sean Wang <sean.wang@...iatek.com>
> ---
>  drivers/rtc/rtc-mt6397.c | 31 ++++++++-----------------------
>  1 file changed, 8 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index cefb83b..bfc5d6f 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -14,6 +14,7 @@
>  
>  #include <linux/delay.h>
>  #include <linux/init.h>
> +#include <linux/interrupt.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  #include <linux/rtc.h>
> @@ -328,10 +329,10 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, rtc);
>  
> -	ret = request_threaded_irq(rtc->irq, NULL,
> -				   mtk_rtc_irq_handler_thread,
> -				   IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
> -				   "mt6397-rtc", rtc);
> +	ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
> +					mtk_rtc_irq_handler_thread,
> +					IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
> +					"mt6397-rtc", rtc);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
>  			rtc->irq, ret);
> @@ -340,30 +341,15 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>  
>  	device_init_wakeup(&pdev->dev, 1);
>  
> -	rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev,
> -					   &mtk_rtc_ops, THIS_MODULE);
> +	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, "mt6397-rtc",
> +						&mtk_rtc_ops, THIS_MODULE);

You should probably switch to devm_rtc_allocate_device() and
rtc_register_device instead of devm_rtc_device_register.

>  	if (IS_ERR(rtc->rtc_dev)) {
>  		dev_err(&pdev->dev, "register rtc device failed\n");
>  		ret = PTR_ERR(rtc->rtc_dev);
> -		goto out_free_irq;
> +		return ret;

ret doesn't seem necessary anymore here.


-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ