File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,6 @@ BBIO_err lookup_uart_by_name(const char *input_name, char *dt)
248248 return BBIO_OK ;
249249 }
250250 }
251- fprintf (stderr , "return 0 lookup_uart_by_name" );
252251 return BBIO_INVARG ;
253252}
254253
@@ -347,8 +346,10 @@ BBIO_err get_adc_ain(const char *key, unsigned int *ain)
347346
348347BBIO_err get_uart_device_tree_name (const char * name , char * dt )
349348{
350- if (!lookup_uart_by_name (name , dt )) {
351- return BBIO_INVARG ;
349+ BBIO_err err ;
350+ err = lookup_uart_by_name (name , dt );
351+ if (err != BBIO_OK ) {
352+ return err ;
352353 }
353354
354355 return BBIO_OK ;
Original file line number Diff line number Diff line change @@ -42,18 +42,21 @@ static PyObject *py_setup_uart(PyObject *self, PyObject *args)
4242{
4343 char dt [FILENAME_BUFFER_SIZE ];
4444 char * channel ;
45+ BBIO_err err ;
4546
4647 if (!PyArg_ParseTuple (args , "s" , & channel )) {
4748 PyErr_SetString (PyExc_ValueError , "Invalid UART channel." );
4849 return NULL ;
4950 }
5051
51- if (!get_uart_device_tree_name (channel , dt )) {
52+ err = get_uart_device_tree_name (channel , dt );
53+ if (err != BBIO_OK ) {
5254 PyErr_SetString (PyExc_ValueError , "Invalid UART channel." );
5355 return NULL ;
5456 }
5557
56- if (!uart_setup (dt )) {
58+ err = uart_setup (dt );
59+ if (err != BBIO_OK ) {
5760 PyErr_SetString (PyExc_RuntimeError , "Unable to export UART channel." );
5861 return NULL ;
5962 }
You can’t perform that action at this time.
0 commit comments