diff options
author | Pan Bian <bianpan2016@163.com> | 2016-12-03 08:56:49 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-19 19:18:03 (GMT) |
commit | 86820a103f517f8d51a09ceacac30bde355f4e89 (patch) | |
tree | 8a997272f05bb57bce45cebbd690312010fb096a | |
parent | ef8ee4495171489ae456c2a6304709cfb5d58881 (diff) | |
download | linux-86820a103f517f8d51a09ceacac30bde355f4e89.tar.xz |
extcon: return error code on failure
commit 5b11ebedd6a8bb4271b796e498cd15c0fe1133b6 upstream.
Function get_zeroed_page() returns a NULL pointer if there is no enough
memory. In function extcon_sync(), it returns 0 if the call to
get_zeroed_page() fails. The return value 0 indicates success in the
context, which is incosistent with the execution status. This patch
fixes the bug by returning -ENOMEM.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611
Signed-off-by: Pan Bian <bianpan2016@163.com>
Fixes: a580982f0836e
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/extcon/extcon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 7829846..7c1e3a7 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) dev_err(&edev->dev, "out of memory in extcon_set_state\n"); kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE); - return 0; + return -ENOMEM; } length = name_show(&edev->dev, NULL, prop_buf); |