add some error checking
add some error checking

Linux-Comedi/comedilib,olsonse/comedilib,Linux-Comedi/comedilib,Linux-Comedi/comedilib,olsonse/comedilib,olsonse/comedilib,olsonse/comedilib,Linux-Comedi/comedilib,olsonse/comedilib,olsonse/comedilib,Linux-Comedi/comedilib,Linux-Comedi/comedilib