Эх сурвалжийг харах

fix warning

Signed-off-by: sakumisu <1203593632@qq.com>
sakumisu 8 сар өмнө
parent
commit
8d8f3e757e

+ 3 - 3
class/vendor/net/usbh_rtl8152.c

@@ -1138,7 +1138,7 @@ static void ocp_write_dword(struct usbh_rtl8152 *tp, uint16_t type, uint16_t ind
 static uint16_t ocp_read_word(struct usbh_rtl8152 *tp, uint16_t type, uint16_t index)
 {
     uint32_t data;
-    uint32_t tmp;
+    uint32_t tmp = 0;
     uint16_t byen = BYTE_EN_WORD;
     uint8_t shift = index & 2;
 
@@ -1178,7 +1178,7 @@ static void ocp_write_word(struct usbh_rtl8152 *tp, uint16_t type, uint16_t inde
 static uint8_t ocp_read_byte(struct usbh_rtl8152 *tp, uint16_t type, uint16_t index)
 {
     uint32_t data;
-    uint32_t tmp;
+    uint32_t tmp = 0;
     uint8_t shift = index & 3;
 
     index &= ~3;
@@ -1254,7 +1254,7 @@ static inline int r8152_mdio_read(struct usbh_rtl8152 *tp, uint32_t reg_addr)
 static uint8_t usbh_rtl8152_get_version(struct usbh_rtl8152 *rtl8152_class)
 {
     uint8_t version;
-    uint32_t temp;
+    uint32_t temp = 0;
     uint32_t ocp_data;
 
     usbh_rtl8152_read_regs(rtl8152_class, PLA_TCR0, MCU_TYPE_PLA, 4, &temp);

+ 1 - 0
platform/rtthread/usb_check.c

@@ -1,4 +1,5 @@
 #include "rtthread.h"
+#include "usb_config.h"
 
 #if defined(PKG_CHERRYUSB_HOST) || defined(RT_CHERRYUSB_HOST)
 

+ 3 - 5
port/dwc2/usb_hc_dwc2.c

@@ -1302,9 +1302,7 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
 
 static void dwc2_port_irq_handler(struct usbh_bus *bus)
 {
-    __IO uint32_t hprt0, hprt0_dup, regval;
-
-    (void)regval;
+    __IO uint32_t hprt0, hprt0_dup;
 
     /* Handle Host Port Interrupts */
     hprt0 = USB_OTG_HPRT;
@@ -1334,7 +1332,7 @@ static void dwc2_port_irq_handler(struct usbh_bus *bus)
             if ((hprt0 & USB_OTG_HPRT_PSPD) == (HPRT0_PRTSPD_LOW_SPEED << 17)) {
                 USB_OTG_HOST->HFIR = 6000U;
                 if ((USB_OTG_HOST->HCFG & USB_OTG_HCFG_FSLSPCS) != USB_OTG_HCFG_FSLSPCS_1) {
-                    regval = USB_OTG_HOST->HCFG;
+                    uint32_t regval = USB_OTG_HOST->HCFG;
                     regval &= ~USB_OTG_HCFG_FSLSPCS;
                     regval |= USB_OTG_HCFG_FSLSPCS_1;
                     USB_OTG_HOST->HCFG = regval;
@@ -1342,7 +1340,7 @@ static void dwc2_port_irq_handler(struct usbh_bus *bus)
             } else {
                 USB_OTG_HOST->HFIR = 48000U;
                 if ((USB_OTG_HOST->HCFG & USB_OTG_HCFG_FSLSPCS) != USB_OTG_HCFG_FSLSPCS_0) {
-                    regval = USB_OTG_HOST->HCFG;
+                    uint32_t regval = USB_OTG_HOST->HCFG;
                     regval &= ~USB_OTG_HCFG_FSLSPCS;
                     regval |= USB_OTG_HCFG_FSLSPCS_0;
                     USB_OTG_HOST->HCFG = regval;