From e922b589f8355baf9dec57ad1fb4694b37b75238 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Wed, 15 Jun 2022 22:09:09 +0800 Subject: [PATCH] fix warnings --- class/hid/usbh_hid.c | 1 - class/msc/usbh_msc.c | 1 - core/usbh_core.c | 6 ++++++ port/musb/usb_hc_musb.c | 9 ++++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/class/hid/usbh_hid.c b/class/hid/usbh_hid.c index 68a3f23a..6af1fc6d 100644 --- a/class/hid/usbh_hid.c +++ b/class/hid/usbh_hid.c @@ -77,7 +77,6 @@ static void usbh_hid_devno_free(struct usbh_hid *hid_class) static int usbh_hid_get_report_descriptor(struct usbh_hid *hid_class, uint8_t *buffer) { struct usb_setup_packet *setup = hid_class->hport->setup; - int ret; setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; diff --git a/class/msc/usbh_msc.c b/class/msc/usbh_msc.c index c044e1f0..a1cc55a2 100644 --- a/class/msc/usbh_msc.c +++ b/class/msc/usbh_msc.c @@ -78,7 +78,6 @@ static void usbh_msc_devno_free(struct usbh_msc *msc_class) static int usbh_msc_get_maxlun(struct usbh_msc *msc_class, uint8_t *buffer) { struct usb_setup_packet *setup = msc_class->hport->setup; - int ret; setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; setup->bRequest = MSC_REQUEST_GET_MAX_LUN; diff --git a/core/usbh_core.c b/core/usbh_core.c index a9f93536..bdf68659 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -841,7 +841,9 @@ int usbh_initialize(void) int lsusb(int argc, char **argv) { +#ifdef CONFIG_USBHOST_HUB usb_slist_t *hub_list; +#endif uint8_t port; if (argc < 2) { @@ -927,7 +929,9 @@ int lsusb(int argc, char **argv) struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr) { +#ifdef CONFIG_USBHOST_HUB usb_slist_t *hub_list; +#endif uint8_t port; for (port = USBH_HUB_PORT_START_INDEX; port <= CONFIG_USBHOST_RHPORTS; port++) { @@ -956,7 +960,9 @@ struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr) void *usbh_find_class_instance(const char *devname) { +#ifdef CONFIG_USBHOST_HUB usb_slist_t *hub_list; +#endif struct usbh_hubport *hport; uint8_t port; diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 148170f2..1c24a0c0 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -554,7 +554,6 @@ int usbh_ep_alloc(usbh_epinfo_t *ep, const struct usbh_endpoint_cfg *ep_cfg) { struct usbh_hubport *hport; struct musb_pipe *chan; - uint32_t chidx; uint8_t ep_idx = 0; uint8_t old_ep_index; @@ -615,7 +614,7 @@ int usbh_ep_alloc(usbh_epinfo_t *ep, const struct usbh_endpoint_cfg *ep_cfg) int usbh_ep_free(usbh_epinfo_t ep) { - struct musb_pipe *chan = (struct musb_pipe *)ep; + //struct musb_pipe *chan = (struct musb_pipe *)ep; return 0; } @@ -1156,7 +1155,7 @@ void USBH_IRQHandler(void) if (is & USB_IS_DISCON) { if (usbh_get_port_connect_status(0) == false) { - for (uint8_t ep_idx = 0; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { + for (ep_idx = 0; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { for (uint8_t j = 0; j < 2; j++) { chan = &g_musb_hcd.chan[ep_idx][j]; @@ -1197,7 +1196,7 @@ void USBH_IRQHandler(void) handle_ep0(); } - for (uint32_t ep_idx = 1; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { + for (ep_idx = 1; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { if (txis & (1 << ep_idx)) { HWREGH(USB_BASE + MUSB_TXIS_OFFSET) = (1 << ep_idx); @@ -1242,7 +1241,7 @@ void USBH_IRQHandler(void) } rxis &= HWREGH(USB_BASE + MUSB_RXIE_OFFSET); - for (uint32_t ep_idx = 1; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { + for (ep_idx = 1; ep_idx < CONIFG_USB_MUSB_PIPE_NUM; ep_idx++) { if (rxis & (1 << ep_idx)) { HWREGH(USB_BASE + MUSB_RXIS_OFFSET) = (1 << ep_idx); // clear isr flag