[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e46b595d-b1f0-617e-d755-7a3cc84ab107@mev.co.uk>
Date: Thu, 16 Nov 2017 13:57:16 +0000
From: Ian Abbott <abbotti@....co.uk>
To: Arvind Yadav <arvind.yadav.cs@...il.com>,
hsweeten@...ionengravers.com, gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org
Subject: Re: [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_*
On 16/11/17 04:32, Arvind Yadav wrote:
> pnp_irq() and pnp_port_start() can fail here and we must check
> its return value.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
> ---
> drivers/staging/comedi/drivers/ni_atmio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c
> index 2d62a8c..dead159 100644
> --- a/drivers/staging/comedi/drivers/ni_atmio.c
> +++ b/drivers/staging/comedi/drivers/ni_atmio.c
> @@ -308,6 +308,9 @@ static int ni_atmio_attach(struct comedi_device *dev,
>
> iobase = pnp_port_start(isapnp_dev, 0);
> irq = pnp_irq(isapnp_dev, 0);
> + if (irq == -1 || !iobase)
> + return -ENOMEM;
> +
> comedi_set_hw_dev(dev, &isapnp_dev->dev);
> }
>
>
Can they fail here? ni_isapnp_find_board() has already checked they are
valid.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@....co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
Powered by blists - more mailing lists