Re: [PATCH 19/51] staging: comedi: me4000: refactor request_irq() during attach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
>>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>>> ---
>>>  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@xxxxxxxxx>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux