[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a1e65999-aa59-e7f9-f715-72695249edf6@gmail.com>
Date: Fri, 17 Nov 2017 08:49:40 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Arvind Yadav <arvind.yadav.cs@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vlynq : Handle return value of platform_get_irq_byname
and vlynq_probe
On 11/17/2017 08:21 AM, Arvind Yadav wrote:
> platform_get_irq_byname() can fail here and we must check its return value.
>
> device_register() can fail here, initialised 'result' variable
> beforen'goto fail_register' otherwise vlynq_probe will return uninitialised
> 'result' variable.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
> ---
> drivers/vlynq/vlynq.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c
> index c0227f9..bc735f9 100644
> --- a/drivers/vlynq/vlynq.c
> +++ b/drivers/vlynq/vlynq.c
> @@ -722,13 +722,19 @@ static int vlynq_probe(struct platform_device *pdev)
> VLYNQ_REMOTE_OFFSET);
>
> dev->irq = platform_get_irq_byname(pdev, "irq");
> + if (dev->irq < 0) {
> + result = dev->irq;
> + goto fail_register;
> + }
That part looks fine.
> dev->irq_start = irq_res->start;
> dev->irq_end = irq_res->end;
> dev->local_irq = dev->irq_end - dev->irq_start;
> dev->remote_irq = dev->local_irq - 1;
>
> - if (device_register(&dev->dev))
> + if (device_register(&dev->dev)) {
> + result = -ENXIO;
> goto fail_register;
> + }
However here, we should propagate the return value of device_register()
to be consistent with the changes earlier.
> platform_set_drvdata(pdev, dev);
>
> printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n",
>
--
Florian
Powered by blists - more mailing lists