Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: Return error code on failure

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>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Pan Bian and committed by
Chanwoo Choi
e7d9dd5a 8a522bf2

+1 -1
+1 -1
drivers/extcon/extcon.c
··· 453 453 dev_err(&edev->dev, "out of memory in extcon_set_state\n"); 454 454 kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE); 455 455 456 - return 0; 456 + return -ENOMEM; 457 457 } 458 458 459 459 length = name_show(&edev->dev, NULL, prop_buf);