unix: Use mp_raise_OSError helper function.

This commit is contained in:
Damien George
2016-10-07 14:05:15 +11:00
parent 23a568240d
commit 503089ea9d
9 changed files with 18 additions and 16 deletions

View File

@@ -27,7 +27,7 @@
#include <stdio.h>
#include <stdint.h>
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/obj.h"
#include "extmod/machine_mem.h"
@@ -58,7 +58,7 @@ uintptr_t mod_machine_mem_get_addr(mp_obj_t addr_o, uint align) {
if (!fd) {
fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno)));
mp_raise_OSError(errno);
}
}