diff options
| author | guozhanxin <[email protected]> | 2021-03-24 09:31:59 +0800 |
|---|---|---|
| committer | guozhanxin <[email protected]> | 2021-03-24 09:32:12 +0800 |
| commit | f9be3c80e3631ebfc1ecc3e1f1d2df21277c0608 (patch) | |
| tree | 1113ef08920b2ff55e97bc84fef0be45b031175e /bsp/simulator | |
| parent | 50bf4902636eda180d33f12a52bb21a7d603bdf8 (diff) | |
add error checks of rt_mutex_create()
Diffstat (limited to 'bsp/simulator')
| -rwxr-xr-x | bsp/simulator/drivers/sd_sim.c | 6 | ||||
| -rwxr-xr-x | bsp/simulator/drivers/sdl_fb.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/bsp/simulator/drivers/sd_sim.c b/bsp/simulator/drivers/sd_sim.c index 41c495403a..adc489be20 100755 --- a/bsp/simulator/drivers/sd_sim.c +++ b/bsp/simulator/drivers/sd_sim.c @@ -133,7 +133,6 @@ static rt_err_t rt_sdcard_control(rt_device_t dev, int cmd, void *args) return RT_EOK; } - rt_err_t rt_hw_sdcard_init(const char *spi_device_name) { int size; @@ -144,6 +143,11 @@ rt_err_t rt_hw_sdcard_init(const char *spi_device_name) device = &(sd->parent); lock = rt_mutex_create("lock", RT_IPC_FLAG_FIFO); + if (lock == RT_NULL) + { + LOG_E("Create mutex in rt_hw_sdcard_init failed!"); + return -RT_ERROR; + } /* open sd card file, if not exist, then create it */ sd->file = fopen(SDCARD_SIM, "rb+"); diff --git a/bsp/simulator/drivers/sdl_fb.c b/bsp/simulator/drivers/sdl_fb.c index 986c3139de..7b25da9c3c 100755 --- a/bsp/simulator/drivers/sdl_fb.c +++ b/bsp/simulator/drivers/sdl_fb.c @@ -221,6 +221,10 @@ static void sdlfb_hw_init(void) rt_device_register(RT_DEVICE(&_device), "sdl", RT_DEVICE_FLAG_RDWR); sdllock = rt_mutex_create("fb", RT_IPC_FLAG_FIFO); + if (sdllock == RT_NULL) + { + LOG_E("Create mutex for sdlfb failed!"); + } } #ifdef _WIN32 |
