[PATCH 19/51] staging: comedi: me4000: refactor request_irq() during attach
Ian Abbott
abbotti at mev.co.uk
Wed Dec 4 14:16:53 UTC 2013
On 2013/12/04 01:05 PM, Dan Carpenter wrote:
> On Wed, Dec 04, 2013 at 11:10:05AM +0000, Ian Abbott wrote:
>> On 2013-12-03 19:07, H Hartley Sweeten wrote:
>>> Do the request_irq() before setting up the subdevices. This removes an
>>> indent level and makes the code a bit cleaner.
>>>
>>> Also, remove the dev_warn() noise about the irq.
>>>
>>> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
>>> Cc: Ian Abbott <abbotti at mev.co.uk>
>>> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
>>> ---
>>> drivers/staging/comedi/drivers/me4000.c | 29 +++++++++++++----------------
>>> 1 file changed, 13 insertions(+), 16 deletions(-)
>>>
>>> diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
>>> index 3d12e91..b7284d0 100644
>>> --- a/drivers/staging/comedi/drivers/me4000.c
>>> +++ b/drivers/staging/comedi/drivers/me4000.c
>>> @@ -1505,6 +1505,13 @@ static int me4000_auto_attach(struct comedi_device *dev,
>>>
>>> me4000_reset(dev);
>>>
>>> + if (pcidev->irq > 0) {
>>> + result = request_irq(pcidev->irq, me4000_ai_isr, IRQF_SHARED,
>>> + dev->board_name, dev);
>>> + if (result == 0)
>>> + dev->irq = pcidev->irq;
>>> + }
>>> +
>>> result = comedi_alloc_subdevices(dev, 4);
>>
>> This will cause a NULL pointer dereference on the following line in
>> me4000_ai_isr():
>>
>> struct comedi_subdevice *s = &dev->subdevices[0];
>>
>
> That's not a dereference, you're just taking the address. Even if "dev"
> is NULL it won't crash.
Yes, I'll give you that one!
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti at mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
More information about the devel
mailing list