summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakimisu <[email protected]>2023-02-09 21:13:12 +0800
committersakimisu <[email protected]>2023-02-09 21:13:12 +0800
commit921ed9b697b7a0a8d4a9f6137285f741573b407e (patch)
treeb725f1eb48ed8370b64df83a33c7f1e3b00a8816
parent4070603e572c5407e94527d702d006dc62bee250 (diff)
Revert "check if hport is null"
This reverts commit 63bc4e936327850de6935870c0f08c6133d12fcb.
-rw-r--r--core/usbh_core.c8
-rw-r--r--core/usbh_core.h1
2 files changed, 4 insertions, 5 deletions
diff --git a/core/usbh_core.c b/core/usbh_core.c
index 9875cdaa..6eb4ccd4 100644
--- a/core/usbh_core.c
+++ b/core/usbh_core.c
@@ -648,7 +648,7 @@ struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr)
struct usbh_hub *hub = usb_slist_entry(hub_list, struct usbh_hub, list);
for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {
hport = &hub->child[port];
- if (hport && hport->connected) {
+ if (hport->connected) {
if (hport->dev_addr == dev_addr) {
return &hub->child[port];
}
@@ -668,7 +668,7 @@ void *usbh_find_class_instance(const char *devname)
struct usbh_hub *hub = usb_slist_entry(hub_list, struct usbh_hub, list);
for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {
hport = &hub->child[port];
- if (hport && hport->connected) {
+ if (hport->connected) {
for (uint8_t itf = 0; itf < hport->config.config_desc.bNumInterfaces; itf++) {
if ((strncmp(hport->config.intf[itf].devname, devname, CONFIG_USBHOST_DEV_NAMELEN) == 0) && hport->config.intf[itf].priv)
return hport->config.intf[itf].priv;
@@ -766,7 +766,7 @@ int lsusb(int argc, char **argv)
for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {
hport = &hub->child[port];
- if (hport && hport->connected) {
+ if (hport->connected) {
for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) {
if (hport->config.intf[i].class_driver->driver_name) {
USB_LOG_RAW(" |__Port %u,Port addr:0x%02x,If %u,ClassDriver=%s\r\n",
@@ -787,7 +787,7 @@ int lsusb(int argc, char **argv)
struct usbh_hub *hub = usb_slist_entry(i, struct usbh_hub, list);
for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) {
hport = &hub->child[port];
- if (hport && hport->connected) {
+ if (hport->connected) {
USB_LOG_RAW("Hub %02u,Port %u,Port addr:0x%02x,VID:PID 0x%04x:0x%04x\r\n",
hub->index,
hport->port,
diff --git a/core/usbh_core.h b/core/usbh_core.h
index 9c83fba5..99f3a350 100644
--- a/core/usbh_core.h
+++ b/core/usbh_core.h
@@ -183,7 +183,6 @@ int usbh_initialize(void);
struct usbh_hubport *usbh_find_hubport(uint8_t dev_addr);
void *usbh_find_class_instance(const char *devname);
-
int lsusb(int argc, char **argv);
#ifdef __cplusplus
}