From: Ian Abbott Date: Thu, 15 Dec 2011 20:21:09 +0000 (+0000) Subject: me4000: check for unsupported INSN_CONFIG X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b5fe10aab510daa70dbee7e05710608b21faaeff;p=comedi.git me4000: check for unsupported INSN_CONFIG The INSN_CONFIG handler for the DIO subdevice should error out for unsupported configuration instruction codes. Signed-off-by: Ian Abbott --- diff --git a/comedi/drivers/me4000.c b/comedi/drivers/me4000.c index 5da6e502..eb45b483 100644 --- a/comedi/drivers/me4000.c +++ b/comedi/drivers/me4000.c @@ -2049,24 +2049,30 @@ static int me4000_dio_insn_config(comedi_device * dev, CALL_PDEBUG("In me4000_dio_insn_config()\n"); - if (data[0] == INSN_CONFIG_DIO_QUERY) { + switch (data[0]) { + default: + return -EINVAL; + case INSN_CONFIG_DIO_QUERY: data[1] = (s-> io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT; return insn->n; + case INSN_CONFIG_DIO_INPUT: + case INSN_CONFIG_DIO_OUTPUT: + break; } /* * The input or output configuration of each digital line is * configured by a special insn_config instruction. chanspec * contains the channel to be changed, and data[0] contains the - * value COMEDI_INPUT or COMEDI_OUTPUT. + * value INSN_CONFIG_DIO_INPUT or INSN_CONFIG_DIO_OUTPUT. * On the ME-4000 it is only possible to switch port wise (8 bit) */ tmp = me4000_inl(dev, info->dio_context.ctrl_reg); - if (data[0] == COMEDI_OUTPUT) { + if (data[0] == INSN_CONFIG_DIO_INPUT) { if (chan < 8) { s->io_bits |= 0xFF; tmp &= ~(ME4000_DIO_CTRL_BIT_MODE_0 |