summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/legacy/inode.c
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2014-07-20 07:42:07 +0400
committerFelipe Balbi <balbi@ti.com>2014-08-19 18:27:24 +0400
commit7042e8f2f6f5c76b6173748570312bbeb044c7dd (patch)
tree9542c4115e209f0652993af290b6c17df16795c1 /drivers/usb/gadget/legacy/inode.c
parent788b0bc46558d06f923afae59f881356ac382381 (diff)
downloadlinux-7042e8f2f6f5c76b6173748570312bbeb044c7dd.tar.xz
usb: gadget: Fix return value check in ep_write()
In case of error, the function memdup_user() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/legacy/inode.c')
-rw-r--r--drivers/usb/gadget/legacy/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index 2e4ce7704908..e96077b8bf79 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
value = -ENOMEM;
kbuf = memdup_user(buf, len);
- if (!kbuf) {
+ if (IS_ERR(kbuf)) {
value = PTR_ERR(kbuf);
goto free1;
}