int ret;
ret = gpiod_line_update(self->line);
- if (ret) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (ret)
+ return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
rv = gpiod_line_event_read(self->line, &ret->event);
Py_END_ALLOW_THREADS;
if (rv) {
- PyErr_SetFromErrno(PyExc_OSError);
Py_DECREF(ret);
- return NULL;
+ return (gpiod_LineEventObject *)PyErr_SetFromErrno(
+ PyExc_OSError);
}
Py_INCREF(self);
Py_BEGIN_ALLOW_THREADS;
rv = gpiod_line_request_bulk(&bulk, &conf, default_vals);
Py_END_ALLOW_THREADS;
- if (rv) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (rv)
+ return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
Py_BEGIN_ALLOW_THREADS;
rv = gpiod_line_get_value_bulk(&bulk, vals);
Py_END_ALLOW_THREADS;
- if (rv) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (rv)
+ return PyErr_SetFromErrno(PyExc_OSError);
val_list = PyList_New(self->num_lines);
if (!val_list)
Py_BEGIN_ALLOW_THREADS;
rv = gpiod_line_set_value_bulk(&bulk, vals);
Py_END_ALLOW_THREADS;
- if (rv) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (rv)
+ return PyErr_SetFromErrno(PyExc_OSError);
Py_RETURN_NONE;
}
Py_BEGIN_ALLOW_THREADS;
rv = gpiod_line_event_wait_bulk(&bulk, &ts, &ev_bulk);
Py_END_ALLOW_THREADS;
- if (rv < 0) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- } else if (rv == 0) {
+ if (rv < 0)
+ return PyErr_SetFromErrno(PyExc_OSError);
+ else if (rv == 0)
Py_RETURN_NONE;
- }
ret = PyList_New(gpiod_line_bulk_num_lines(&ev_bulk));
if (!ret)
Py_BEGIN_ALLOW_THREADS;
line = gpiod_chip_get_line(self->chip, offset);
Py_END_ALLOW_THREADS;
- if (!line) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (!line)
+ return (gpiod_LineObject *)PyErr_SetFromErrno(PyExc_OSError);
return gpiod_MakeLineObject(self, line);
}
return (gpiod_LineObject *)Py_None;
}
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
+ return (gpiod_LineObject *)PyErr_SetFromErrno(PyExc_OSError);
}
return gpiod_MakeLineObject(self, line);
return NULL;
rv = gpiod_chip_get_all_lines(self->chip, &bulk);
- if (rv) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
+ if (rv)
+ return (gpiod_LineBulkObject *)PyErr_SetFromErrno(
+ PyExc_OSError);
list = PyList_New(gpiod_line_bulk_num_lines(&bulk));
if (!list)
return (gpiod_LineObject *)Py_None;
}
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
+ return (gpiod_LineObject *)PyErr_SetFromErrno(PyExc_OSError);
}
chip = gpiod_line_get_chip(line);