From: arvindY <arvind.yadav.cs@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
hsweeten@visionengravers.com, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Subject: Re: [PATCH] staging: comedi: ni_atmio: Handle return value of pnp_*
Date: Fri, 17 Nov 2017 12:06:07 +0530 [thread overview]
Message-ID: <5A0E8357.3070306@gmail.com> (raw)
In-Reply-To: <e46b595d-b1f0-617e-d755-7a3cc84ab107@mev.co.uk>
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
prev parent reply other threads:[~2017-11-17 6:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5A0E8357.3070306@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox