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>
This commit is contained in:
Wei Yongjun 2014-07-20 11:42:07 +08:00 committed by Felipe Balbi
parent 788b0bc465
commit 7042e8f2f6

View File

@ -440,7 +440,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
value = -ENOMEM; value = -ENOMEM;
kbuf = memdup_user(buf, len); kbuf = memdup_user(buf, len);
if (!kbuf) { if (IS_ERR(kbuf)) {
value = PTR_ERR(kbuf); value = PTR_ERR(kbuf);
goto free1; goto free1;
} }