From: H Hartley Sweeten Date: Tue, 14 May 2013 21:36:11 +0000 (-0700) Subject: staging: comedi: dt9812: do not allow attaching to unsupported devices X-Git-Tag: firefly_0821_release~176^2~5845^2~603 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9a054c278d951720e8761151b6ff9d7e1948258e;p=firefly-linux-kernel-4.4.55.git staging: comedi: dt9812: do not allow attaching to unsupported devices 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 Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c index e6d9191f9432..9aab5b9a8738 100644 --- a/drivers/staging/comedi/drivers/dt9812.c +++ b/drivers/staging/comedi/drivers/dt9812.c @@ -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; }