summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
authorDavid Lin <[email protected]>2020-03-21 20:54:13 +0800
committerGitHub <[email protected]>2020-03-21 20:54:13 +0800
commit10e0f2875428f453e22b77ce194719710c40da07 (patch)
tree1bb18dcf0892bef982f1fb36571af4ea60b8a9ae /components/drivers
parent3679dfa07eee22e4df5517a1c3b26e018e3bd971 (diff)
Update cdc_vcom.c
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/usb/usbdevice/class/cdc_vcom.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c
index c94a438131..c4fc3b0ad9 100644
--- a/components/drivers/usb/usbdevice/class/cdc_vcom.c
+++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c
@@ -493,6 +493,7 @@ static rt_err_t _function_enable(ufunction_t func)
data = (struct vcom*)func->user_data;
data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE);
+ RT_ASSERT(data->ep_out->buffer != RT_NULL);
data->ep_out->request.buffer = data->ep_out->buffer;
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
@@ -593,6 +594,7 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
/* allocate memory for cdc vcom data */
data = (struct vcom*)rt_malloc(sizeof(struct vcom));
+ RT_ASSERT(data != RT_NULL);
rt_memset(data, 0, sizeof(struct vcom));
func->user_data = (void*)data;