* [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_*
@ 2017-11-16 4:32 Arvind Yadav
2017-11-16 13:57 ` Ian Abbott
0 siblings, 1 reply; 3+ messages in thread
From: Arvind Yadav @ 2017-11-16 4:32 UTC (permalink / raw
To: abbotti, hsweeten, gregkh; +Cc: linux-kernel, devel
pnp_irq() and pnp_port_start() can fail here and we must check
its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_*
2017-11-16 4:32 [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_* Arvind Yadav
@ 2017-11-16 13:57 ` Ian Abbott
2017-11-17 6:36 ` arvindY
0 siblings, 1 reply; 3+ messages in thread
From: Ian Abbott @ 2017-11-16 13:57 UTC (permalink / raw
To: Arvind Yadav, hsweeten, gregkh; +Cc: linux-kernel, devel
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@gmail.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@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_*
2017-11-16 13:57 ` Ian Abbott
@ 2017-11-17 6:36 ` arvindY
0 siblings, 0 replies; 3+ messages in thread
From: arvindY @ 2017-11-17 6:36 UTC (permalink / raw
To: Ian Abbott, hsweeten, gregkh; +Cc: linux-kernel, devel
hi,
On Thursday 16 November 2017 07:27 PM, Ian Abbott wrote:
> 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@gmail.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.
Yes, you are right. It will not fail.
~arvind
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-17 6:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-16 4:32 [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_* Arvind Yadav
2017-11-16 13:57 ` Ian Abbott
2017-11-17 6:36 ` arvindY
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.