提交 8ae11d8d 编写于 作者: F Far

fix: codex clean

1. 修复了一个可能的对NULL指针解引用的场景
2. 修复了一个使用未初始化变量的场景

Close #I3UOFN
Signed-off-by: NFar <yesiyuan2@huawei.com>
上级 000b21f0
......@@ -656,7 +656,7 @@ usb_control_msg(struct usb_device *dev, struct usb_host_endpoint *uhe,
struct usb_device_request req;
struct urb *urb;
int err;
uint16_t actlen;
uint16_t actlen = 0;
uint8_t type;
uint8_t addr;
......
......@@ -1270,6 +1270,7 @@ uhub_attach(device_t dev)
uint8_t portno;
uint8_t removable;
uint8_t iface_index;
device_t device;
usb_error_t err;
if (!sc || !uaa || !uaa->device)
......@@ -1558,7 +1559,12 @@ uhub_attach(device_t dev)
break;
if (portno == 1) { /* if it is the hub 1 port */
if (udev->parent_hub == NULL) { /* parent is bus */
parent_info.nameunit = device_get_nameunit(devclass_get_device(devclass_find("usbus"), 0));
device = devclass_get_device(devclass_find("usbus"), 0);
if (device == NULL) {
device_printf(dev, "Can't find device of class usbus\n");
goto error;
}
parent_info.nameunit = device_get_nameunit(device);
parent_info.port_no = 0;
} else { /* parent is hub */
parent_info.nameunit = device_get_nameunit(udev->parent_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册