lkml.org 
[lkml]   [2017]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] clocksource: em_sti: fix error return codes in em_sti_probe()
On Fri, Jun 30, 2017 at 6:42 AM, Gustavo A. R. Silva
<garsilva@embeddedor.com> wrote:
> Propagate the return values of platform_get_irq and
> devm_request_irq on failure.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> 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.

\
 
 \ /
  Last update: 2017-06-30 07:45    [W:0.065 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site