Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755342AbbG3J6N (ORCPT ); Thu, 30 Jul 2015 05:58:13 -0400 Received: from eusmtp01.atmel.com ([212.144.249.243]:4748 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755277AbbG3J6M (ORCPT ); Thu, 30 Jul 2015 05:58:12 -0400 Message-ID: <55B9F4F1.2060901@atmel.com> Date: Thu, 30 Jul 2015 11:57:05 +0200 From: Nicolas Ferre Organization: atmel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Alexandre Belloni CC: Boris Brezillon , , , Alessandro Zummo , Subject: Re: [PATCH 1/5] rtc: at91sam9: properly handle error case References: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> In-Reply-To: <1438215872-27794-1-git-send-email-alexandre.belloni@free-electrons.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1934 Lines: 64 Le 30/07/2015 02:24, Alexandre Belloni a ?crit : > 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: Nicolas Ferre Thanks. > --- > 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; > } > > /* > -- Nicolas Ferre -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/