浏览代码

[errno code]fix that use RT_ENOMEM without -

Zxy 2 年之前
父节点
当前提交
156fda61cf

+ 2 - 2
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;
     }
 

+ 1 - 1
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;
     }
 

+ 1 - 1
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);

+ 1 - 1
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));

+ 3 - 3
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;
     }
 

+ 2 - 2
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;
     }

+ 1 - 1
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;
     }
 

+ 1 - 1
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,

+ 2 - 2
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;

+ 2 - 2
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);