}
 EXPORT_SYMBOL_GPL(comedi_is_subdevice_running);
 
+static bool comedi_is_subdevice_in_error(struct comedi_subdevice *s)
+{
+       unsigned runflags = comedi_get_subdevice_runflags(s);
+
+       return (runflags & SRF_ERROR) ? true : false;
+}
+
 /*
    This function restores a subdevice to an idle state.
  */
 
                if (!comedi_is_subdevice_running(s)) {
                        if (count == 0) {
-                               if (comedi_get_subdevice_runflags(s) &
-                                       SRF_ERROR) {
+                               if (comedi_is_subdevice_in_error(s))
                                        retval = -EPIPE;
-                               } else {
+                               else
                                        retval = 0;
-                               }
                                do_become_nonbusy(dev, s);
                        }
                        break;
                if (n == 0) {
                        if (!comedi_is_subdevice_running(s)) {
                                do_become_nonbusy(dev, s);
-                               if (comedi_get_subdevice_runflags(s) &
-                                   SRF_ERROR) {
+                               if (comedi_is_subdevice_in_error(s))
                                        retval = -EPIPE;
-                               } else {
+                               else
                                        retval = 0;
-                               }
                                break;
                        }
                        if (file->f_flags & O_NONBLOCK) {