From: David Schleef Date: Sat, 27 May 2000 00:54:17 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: r0_7_45~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cca58e07ff0312f9214fba27d787a284e3623e01;p=comedi.git *** empty log message *** --- diff --git a/comedi/kcomedilib/kcomedilib_main.c b/comedi/kcomedilib/kcomedilib_main.c index 08ad221f..0f0ae3cb 100644 --- a/comedi/kcomedilib/kcomedilib_main.c +++ b/comedi/kcomedilib/kcomedilib_main.c @@ -297,19 +297,21 @@ int comedi_get_krange(unsigned int minor,unsigned int subdevice,unsigned int cha { comedi_device *dev; comedi_subdevice *s; + comedi_lrange *lr; int ret; if ((ret=minor_to_subdevchan(minor,subdevice,&dev,&s,chan))!=0) return ret; if (s->range_table_list) { - if (range>=s->range_table_list[chan]->length) { - return -EINVAL; - } - memcpy(krange,&s->range_table_list[chan]->range[range],sizeof(comedi_krange)); + lr=s->range_table_list[chan]; } else { - memcpy(krange,&s->range_table->range[range],sizeof(comedi_krange)); + lr=s->range_table; } + if (range>=lr->length) { + return -EINVAL; + } + memcpy(krange,lr->range+range,sizeof(comedi_krange)); return 0; }