]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: dt9812: do not allow attaching to unsupported devices
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 14 May 2013 21:36:11 +0000 (14:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2013 23:26:04 +0000 (16:26 -0700)
The DT9812 is part of the ECONseries of USB Data Acquisition Modules.
This driver only supports the DT9812-10V and DT9812-2.5V versions of
the module. Do not attach to the device if an unsupported module is
detected.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dt9812.c

index e6d9191f9432a56b052cc01de291ddca210a107e..9aab5b9a8738629137f313c617a97cd20c19bbc2 100644 (file)
@@ -768,6 +768,12 @@ static int dt9812_reset_device(struct comedi_device *dev)
        dev_info(dev->class_dev, "USB DT9812 (%4.4x.%4.4x.%4.4x) #0x%8.8x\n",
                 vendor, product, devpriv->device, serial);
 
+       if (devpriv->device != DT9812_DEVID_DT9812_10 &&
+           devpriv->device != DT9812_DEVID_DT9812_2PT5) {
+               dev_err(dev->class_dev, "Unsupported device!\n");
+               return -EINVAL;
+       }
+
        return 0;
 }