Commit b4f28a98 authored by Dan Carpenter's avatar Dan Carpenter Committed by Felipe Balbi

usb: dwc3: debugfs: add a kfree() on error to dwc3_testmode_open()

We may as well fix this potential leak so we don't have to listen to
the static checkers complain.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 0156cf86
...@@ -445,8 +445,10 @@ static int dwc3_testmode_open(struct inode *inode, struct file *file) ...@@ -445,8 +445,10 @@ static int dwc3_testmode_open(struct inode *inode, struct file *file)
if (!buf0) if (!buf0)
return -ENOMEM; return -ENOMEM;
buf1 = kmalloc(BUF_SIZE, GFP_KERNEL); buf1 = kmalloc(BUF_SIZE, GFP_KERNEL);
if (!buf1) if (!buf1) {
kfree(buf0);
return -ENOMEM; return -ENOMEM;
}
memset(buf0, 0xaa, BUF_SIZE); memset(buf0, 0xaa, BUF_SIZE);
memset(buf1, 0x33, BUF_SIZE); memset(buf1, 0x33, BUF_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment