From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.free-electrons.com (down.free-electrons.com. [37.187.137.238]) by gmr-mx.google.com with ESMTP id ec7si46690wib.3.2015.07.30.02.28.58 for ; Thu, 30 Jul 2015 02:28:58 -0700 (PDT) Date: Thu, 30 Jul 2015 11:28:52 +0200 From: Boris Brezillon To: Alexandre Belloni Cc: Nicolas Ferre , linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, Alessandro Zummo , linux-kernel@vger.kernel.org Subject: [rtc-linux] Re: [PATCH 1/5] rtc: at91sam9: properly handle error case Message-ID: <20150730112852.79dcb30a@bbrezillon> In-Reply-To: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On Thu, 30 Jul 2015 02:24:28 +0200 Alexandre Belloni wrote: > In case of a probe error, it is possible to abort after issuing > clk_prepare_enable(). Ensure the clock is disabled and unprepared in that > case. > > Signed-off-by: Alexandre Belloni To the whole series: Acked-by: Boris Brezillon > --- > drivers/rtc/rtc-at91sam9.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c > index 5ccaee32df72..152cd816cc43 100644 > --- a/drivers/rtc/rtc-at91sam9.c > +++ b/drivers/rtc/rtc-at91sam9.c > @@ -451,8 +451,10 @@ static int at91_rtc_probe(struct platform_device *pdev) > > rtc->rtcdev = devm_rtc_device_register(&pdev->dev, pdev->name, > &at91_rtc_ops, THIS_MODULE); > - if (IS_ERR(rtc->rtcdev)) > - return PTR_ERR(rtc->rtcdev); > + if (IS_ERR(rtc->rtcdev)) { > + ret = PTR_ERR(rtc->rtcdev); > + goto err_clk; > + } > > /* register irq handler after we know what name we'll use */ > ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt, > @@ -460,7 +462,7 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev), rtc); > if (ret) { > dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq); > - return ret; > + goto err_clk; > } > > /* NOTE: sam9260 rev A silicon has a ROM bug which resets the > @@ -474,6 +476,11 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev)); > > return 0; > + > +err_clk: > + clk_disable_unprepare(rtc->sclk); > + > + return ret; > } > > /* -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 From: boris.brezillon@free-electrons.com (Boris Brezillon) Date: Thu, 30 Jul 2015 11:28:52 +0200 Subject: [PATCH 1/5] rtc: at91sam9: properly handle error case In-Reply-To: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> Message-ID: <20150730112852.79dcb30a@bbrezillon> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, 30 Jul 2015 02:24:28 +0200 Alexandre Belloni wrote: > In case of a probe error, it is possible to abort after issuing > clk_prepare_enable(). Ensure the clock is disabled and unprepared in that > case. > > Signed-off-by: Alexandre Belloni To the whole series: Acked-by: Boris Brezillon > --- > drivers/rtc/rtc-at91sam9.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c > index 5ccaee32df72..152cd816cc43 100644 > --- a/drivers/rtc/rtc-at91sam9.c > +++ b/drivers/rtc/rtc-at91sam9.c > @@ -451,8 +451,10 @@ static int at91_rtc_probe(struct platform_device *pdev) > > rtc->rtcdev = devm_rtc_device_register(&pdev->dev, pdev->name, > &at91_rtc_ops, THIS_MODULE); > - if (IS_ERR(rtc->rtcdev)) > - return PTR_ERR(rtc->rtcdev); > + if (IS_ERR(rtc->rtcdev)) { > + ret = PTR_ERR(rtc->rtcdev); > + goto err_clk; > + } > > /* register irq handler after we know what name we'll use */ > ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt, > @@ -460,7 +462,7 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev), rtc); > if (ret) { > dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq); > - return ret; > + goto err_clk; > } > > /* NOTE: sam9260 rev A silicon has a ROM bug which resets the > @@ -474,6 +476,11 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev)); > > return 0; > + > +err_clk: > + clk_disable_unprepare(rtc->sclk); > + > + return ret; > } > > /* -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755355AbbG3J3A (ORCPT ); Thu, 30 Jul 2015 05:29:00 -0400 Received: from down.free-electrons.com ([37.187.137.238]:58803 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753367AbbG3J27 (ORCPT ); Thu, 30 Jul 2015 05:28:59 -0400 Date: Thu, 30 Jul 2015 11:28:52 +0200 From: Boris Brezillon To: Alexandre Belloni Cc: Nicolas Ferre , linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, Alessandro Zummo , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] rtc: at91sam9: properly handle error case Message-ID: <20150730112852.79dcb30a@bbrezillon> In-Reply-To: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Jul 2015 02:24:28 +0200 Alexandre Belloni wrote: > In case of a probe error, it is possible to abort after issuing > clk_prepare_enable(). Ensure the clock is disabled and unprepared in that > case. > > Signed-off-by: Alexandre Belloni To the whole series: Acked-by: Boris Brezillon > --- > drivers/rtc/rtc-at91sam9.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c > index 5ccaee32df72..152cd816cc43 100644 > --- a/drivers/rtc/rtc-at91sam9.c > +++ b/drivers/rtc/rtc-at91sam9.c > @@ -451,8 +451,10 @@ static int at91_rtc_probe(struct platform_device *pdev) > > rtc->rtcdev = devm_rtc_device_register(&pdev->dev, pdev->name, > &at91_rtc_ops, THIS_MODULE); > - if (IS_ERR(rtc->rtcdev)) > - return PTR_ERR(rtc->rtcdev); > + if (IS_ERR(rtc->rtcdev)) { > + ret = PTR_ERR(rtc->rtcdev); > + goto err_clk; > + } > > /* register irq handler after we know what name we'll use */ > ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt, > @@ -460,7 +462,7 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev), rtc); > if (ret) { > dev_dbg(&pdev->dev, "can't share IRQ %d?\n", rtc->irq); > - return ret; > + goto err_clk; > } > > /* NOTE: sam9260 rev A silicon has a ROM bug which resets the > @@ -474,6 +476,11 @@ static int at91_rtc_probe(struct platform_device *pdev) > dev_name(&rtc->rtcdev->dev)); > > return 0; > + > +err_clk: > + clk_disable_unprepare(rtc->sclk); > + > + return ret; > } > > /* -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com