|
@@ -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+");
|