Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbdF3FwE (ORCPT ); Fri, 30 Jun 2017 01:52:04 -0400 Received: from gateway33.websitewelcome.com ([192.185.146.82]:36691 "EHLO gateway33.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbdF3FwC (ORCPT ); Fri, 30 Jun 2017 01:52:02 -0400 Date: Fri, 30 Jun 2017 00:51:59 -0500 Message-ID: <20170630005159.Horde.VRzatQ47NIg6bg-4JOnsxrf@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Frans Klaver Cc: Daniel Lezcano , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] clocksource: em_sti: fix error return codes in em_sti_probe() References: <20170630044214.GA14004@embeddedgus> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Exim-ID: 1dQoqW-001bes-0f X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:28987 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1968 Lines: 56 Hi Frans, Quoting Frans Klaver : > On Fri, Jun 30, 2017 at 6:42 AM, Gustavo A. R. Silva > wrote: >> Propagate the return values of platform_get_irq and >> devm_request_irq on failure. >> >> Signed-off-by: Gustavo A. R. Silva >> --- >> drivers/clocksource/em_sti.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c >> index bc48cbf..c4818dd 100644 >> --- a/drivers/clocksource/em_sti.c >> +++ b/drivers/clocksource/em_sti.c >> @@ -305,7 +305,7 @@ static int em_sti_probe(struct platform_device *pdev) >> irq = platform_get_irq(pdev, 0); >> if (irq < 0) { >> dev_err(&pdev->dev, "failed to get irq\n"); >> - return -EINVAL; >> + return irq; >> } >> >> /* map memory, let base point to the STI instance */ >> @@ -314,11 +314,12 @@ static int em_sti_probe(struct platform_device *pdev) >> if (IS_ERR(p->base)) >> return PTR_ERR(p->base); >> >> - if (devm_request_irq(&pdev->dev, irq, em_sti_interrupt, >> + irq = devm_request_irq(&pdev->dev, irq, em_sti_interrupt, >> IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, >> - dev_name(&pdev->dev), p)) { >> + dev_name(&pdev->dev), p); >> + if (irq) { >> dev_err(&pdev->dev, "failed to request low IRQ\n"); >> - return -ENOENT; >> + return irq; >> } > > This works. Yet I think that 'ret' would be a better candidate for > taking the result of devm_request_irq, since it doesn't return the irq > number on success. Should someone decide to reference irq at a later > point in the code, this has to be changed. Good point. I'll change it and send a new patch shortly. Thanks! -- Gustavo A. R. Silva