浏览代码

[bsp] Modify the RT_Exxx error return value to a negative number

褚仕成 2 年之前
父节点
当前提交
0cdf72f753

+ 1 - 1
bsp/mm32f327x/drivers/drv_adc.c

@@ -127,7 +127,7 @@ static rt_uint8_t mm32_adc_get_resolution(struct rt_adc_device *device)
 static rt_int16_t mm32_adc_get_vref(struct rt_adc_device *device)
 {
     if(device == RT_NULL)
-        return RT_ERROR;
+        return -RT_ERROR;
 
     return 3300;
 }

+ 1 - 1
bsp/raspberry-pi/raspi4-64/drivers/drv_eth.c

@@ -574,7 +574,7 @@ static rt_err_t bcmgenet_eth_init(rt_device_t device)
             major = 1;
 
         rt_kprintf("Uns upported GENETv%d.%d\n", major, (hw_reg >> 16) & 0x0f);
-        return RT_ERROR;
+        return -RT_ERROR;
     }
     /* set interface */
     ret = bcmgenet_interface_set();

+ 2 - 2
bsp/raspberry-pi/raspi4-64/drivers/drv_sdio.c

@@ -437,7 +437,7 @@ static rt_err_t sdhci_setclock(struct sdhci_t * sdhci, rt_uint32_t clock)
     if (count <= 0)
     {
         rt_kprintf("EMMC: Set clock: timeout waiting for inhibit flags. Status %08x.\n",read32(pdat->virt + EMMC_STATUS));
-        return RT_ERROR;
+        return -RT_ERROR;
     }
 
     // Switch clock off.
@@ -471,7 +471,7 @@ static rt_err_t sdhci_setclock(struct sdhci_t * sdhci, rt_uint32_t clock)
     if (count <= 0)
     {
         rt_kprintf("EMMC: ERROR: failed to get stable clock %d.\n", clock);
-        return RT_ERROR;
+        return -RT_ERROR;
     }
 
     mmcsd_dbg("set stable clock %d.\n", clock);

+ 1 - 1
bsp/raspberry-pi/raspi4-64/drivers/drv_spi.c

@@ -185,7 +185,7 @@ static rt_uint32_t raspi_spi_xfer(struct rt_spi_device *device, struct rt_spi_me
         (config.mode & RT_SPI_CS_HIGH)?prev_raspi_pin_write(cs_pin, 0):prev_raspi_pin_write(cs_pin, 1);
     }
     if (res != RT_EOK)
-           return RT_ERROR;
+           return -RT_ERROR;
 
     return message->length;
 }

+ 1 - 1
bsp/raspberry-pi/raspi4-64/drivers/drv_wdt.c

@@ -95,7 +95,7 @@ static rt_err_t raspi_wdg_control(rt_watchdog_t *wdt, int cmd, void *arg)
         raspi_watchdog_stop();
         break;
     default:
-        return RT_EIO;
+        return -RT_EIO;
     }
     return RT_EOK;
 }