Skip to content

Commit

Permalink
extcon: return error code on failure
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: a580982
Cc: stable <[email protected]>
Acked-by: Chanwoo Choi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
SinkFinder authored and gregkh committed Jan 11, 2017
1 parent 488debb commit 5b11ebe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5b11ebe

Please sign in to comment.