In ni_670x_detach(), dev->subdevices will be NULL if the call to
alloc_subdevices() failed in ni_670x_attach(), so don't dereference it
until the pointer has been checked.
Spotted by H Hartley Sweeten in the "staging" sources, but used a
different check due to difference in behavior of alloc_subdevices() on
error between the two versions.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
{
printk("comedi%d: ni_670x: remove\n", dev->minor);
- if (dev->subdevices[0].range_table_list) {
+ if (dev->subdevices && dev->subdevices[0].range_table_list) {
kfree(dev->subdevices[0].range_table_list);
}
if (dev->private && devpriv->mite)