From 8d8f3e757efda3d7eb228012b3aacdb29ecca9ff Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Mon, 16 Jun 2025 22:49:55 +0800 Subject: [PATCH] fix warning Signed-off-by: sakumisu <1203593632@qq.com> --- class/vendor/net/usbh_rtl8152.c | 6 +++--- platform/rtthread/usb_check.c | 1 + port/dwc2/usb_hc_dwc2.c | 8 +++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/class/vendor/net/usbh_rtl8152.c b/class/vendor/net/usbh_rtl8152.c index 9c4b6570..145a9e78 100644 --- a/class/vendor/net/usbh_rtl8152.c +++ b/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); diff --git a/platform/rtthread/usb_check.c b/platform/rtthread/usb_check.c index 9ea03c20..4a598fe6 100644 --- a/platform/rtthread/usb_check.c +++ b/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) diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c index 26486761..46effd56 100644 --- a/port/dwc2/usb_hc_dwc2.c +++ b/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;