diff --git a/bsp/at32/libraries/rt_drivers/drv_qspi.c b/bsp/at32/libraries/rt_drivers/drv_qspi.c index c7b59bef1c..144e20e17d 100644 --- a/bsp/at32/libraries/rt_drivers/drv_qspi.c +++ b/bsp/at32/libraries/rt_drivers/drv_qspi.c @@ -444,14 +444,14 @@ rt_err_t at32_qspi_bus_attach_device(const char *bus_name, const char *device_na if (qspi_device == RT_NULL) { LOG_E("no memory, qspi bus attach device failed!"); - result = RT_ENOMEM; + result = -RT_ENOMEM; goto __exit; } cs_pin = (struct at32_hw_spi_cs *)rt_malloc(sizeof(struct at32_hw_spi_cs)); if (qspi_device == RT_NULL) { LOG_E("no memory, qspi bus attach device failed!"); - result = RT_ENOMEM; + result = -RT_ENOMEM; goto __exit; } diff --git a/bsp/ft2004/drivers/drv_qspi.c b/bsp/ft2004/drivers/drv_qspi.c index 3adc399f37..9926f7a59a 100644 --- a/bsp/ft2004/drivers/drv_qspi.c +++ b/bsp/ft2004/drivers/drv_qspi.c @@ -288,7 +288,7 @@ rt_err_t ft2004_qspi_bus_attach_device(const char *bus_name, const char *device_ if (qspi_device == RT_NULL) { LOG_E("no memory, qspi bus attach device failed!"); - result = RT_ENOMEM; + result = -RT_ENOMEM; goto __exit; } diff --git a/bsp/ft2004/drivers/drv_sdctrl.c b/bsp/ft2004/drivers/drv_sdctrl.c index a43a53a2c0..a1e6740046 100644 --- a/bsp/ft2004/drivers/drv_sdctrl.c +++ b/bsp/ft2004/drivers/drv_sdctrl.c @@ -555,7 +555,7 @@ static rt_err_t rthw_sdctrl_create(ft_sdctrl_class_t *class_p) if (host == RT_NULL) { LOG_E("L:%d F:%s mmcsd alloc host fail"); - return RT_ENOMEM; + return -RT_ENOMEM; } class_p->ft_sdctrl.config = *(FSdCtrl_Config_t *)FSdCtrl_LookupConfig(0); diff --git a/bsp/loongson/ls1cdev/drivers/touch.c b/bsp/loongson/ls1cdev/drivers/touch.c index 31076be5ed..b5be15c962 100644 --- a/bsp/loongson/ls1cdev/drivers/touch.c +++ b/bsp/loongson/ls1cdev/drivers/touch.c @@ -561,7 +561,7 @@ rt_err_t rtgui_touch_hw_init(const char * spi_device_name) } touch = (struct rtgui_touch_device*)rt_malloc (sizeof(struct rtgui_touch_device)); - if (touch == RT_NULL) return RT_ENOMEM; /* no memory yet */ + if (touch == RT_NULL) return -RT_ENOMEM; /* no memory yet */ /* clear device structure */ rt_memset(&(touch->parent), 0, sizeof(struct rt_device)); diff --git a/bsp/mini4020/drivers/sdcard.c b/bsp/mini4020/drivers/sdcard.c index 8d15a0035f..bb73a79d05 100644 --- a/bsp/mini4020/drivers/sdcard.c +++ b/bsp/mini4020/drivers/sdcard.c @@ -662,7 +662,7 @@ rt_err_t rt_hw_sdcard_init() if (ptr_sddev == RT_NULL) { EOUT("Failed to allocate sdcard device structure\n"); - return RT_ENOMEM; + return -RT_ENOMEM; } /*sdcard intialize*/ @@ -689,7 +689,7 @@ rt_err_t rt_hw_sdcard_init() if (ptr_sddev->part == RT_NULL) { EOUT("allocate partition failed\n"); - err = RT_ENOMEM; + err = -RT_ENOMEM; goto FAIL2; } @@ -698,7 +698,7 @@ rt_err_t rt_hw_sdcard_init() if (ptr_sddev->device == RT_NULL) { EOUT("allocate device failed\n"); - err = RT_ENOMEM; + err = -RT_ENOMEM; goto FAIL1; } diff --git a/bsp/nrf5x/libraries/drivers/drv_gpio.c b/bsp/nrf5x/libraries/drivers/drv_gpio.c index 747c631210..0992bfdb28 100644 --- a/bsp/nrf5x/libraries/drivers/drv_gpio.c +++ b/bsp/nrf5x/libraries/drivers/drv_gpio.c @@ -225,7 +225,7 @@ static rt_err_t nrf5x_pin_attach_irq(struct rt_device *device, rt_int32_t pin, } if(irqindex == -1) { - return RT_ENOMEM; + return -RT_ENOMEM; } level = rt_hw_interrupt_disable(); @@ -264,7 +264,7 @@ static rt_err_t nrf5x_pin_attach_irq(struct rt_device *device, rt_int32_t pin, case NRFX_SUCCESS: return RT_EOK; case NRFX_ERROR_NO_MEM: - return RT_ENOMEM; + return -RT_ENOMEM; default: return -RT_ERROR; } diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c index a5b8eafa13..9b1b29cd97 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c @@ -319,7 +319,7 @@ rt_err_t rt_hw_qspi_device_attach(const char *bus_name, const char *device_name, if (qspi_device == RT_NULL) { LOG_E("no memory, qspi bus attach device failed!"); - result = RT_ENOMEM; + result = -RT_ENOMEM; goto __exit; } diff --git a/components/drivers/ipc/dataqueue.c b/components/drivers/ipc/dataqueue.c index 03e685a6bf..2222539cdf 100644 --- a/components/drivers/ipc/dataqueue.c +++ b/components/drivers/ipc/dataqueue.c @@ -36,7 +36,7 @@ struct rt_data_item * @param evt_notify is the notification callback function. * * @return Return the operation status. When the return value is RT_EOK, the initialization is successful. - * When the return value is RT_ENOMEM, it means insufficient memory allocation failed. + * When the return value is -RT_ENOMEM, it means insufficient memory allocation failed. */ rt_err_t rt_data_queue_init(struct rt_data_queue *queue, diff --git a/components/drivers/usb/usbhost/core/usbhost_core.c b/components/drivers/usb/usbhost/core/usbhost_core.c index 6f570cc784..cef1600433 100644 --- a/components/drivers/usb/usbhost/core/usbhost_core.c +++ b/components/drivers/usb/usbhost/core/usbhost_core.c @@ -164,7 +164,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) device->cfg_desc = (ucfg_desc_t)rt_malloc(cfg_desc.wTotalLength); if(device->cfg_desc == RT_NULL) { - return RT_ENOMEM; + return -RT_ENOMEM; } rt_memset(device->cfg_desc, 0, cfg_desc.wTotalLength); @@ -225,7 +225,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) device->intf[i] = (struct uhintf*)rt_malloc(sizeof(struct uhintf)); if(device->intf[i] == RT_NULL) { - return RT_ENOMEM; + return -RT_ENOMEM; } device->intf[i]->drv = drv; device->intf[i]->device = device; diff --git a/components/utilities/ymodem/ry_sy.c b/components/utilities/ymodem/ry_sy.c index c6117a53ef..557d4bcdab 100644 --- a/components/utilities/ymodem/ry_sy.c +++ b/components/utilities/ymodem/ry_sy.c @@ -199,7 +199,7 @@ static rt_err_t rym_download_file(rt_device_t idev,const char *file_path) if (!ctx) { rt_kprintf("rt_malloc failed\n"); - return RT_ENOMEM; + return -RT_ENOMEM; } ctx->fd = -1; rt_strncpy(ctx->fpath, file_path, DFS_PATH_MAX); @@ -219,7 +219,7 @@ static rt_err_t rym_upload_file(rt_device_t idev, const char *file_path) if (!ctx) { rt_kprintf("rt_malloc failed\n"); - return RT_ENOMEM; + return -RT_ENOMEM; } ctx->fd = -1; rt_strncpy(ctx->fpath, file_path, DFS_PATH_MAX);