Skip to content

Commit 5b11ebe

Browse files
SinkFindergregkh
authored andcommitted
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> Fixes: a580982 Cc: stable <stable@vger.kernel.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 488debb commit 5b11ebe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/extcon/extcon.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id)
453453
dev_err(&edev->dev, "out of memory in extcon_set_state\n");
454454
kobject_uevent(&edev->dev.kobj, KOBJ_CHANGE);
455455

456-
return 0;
456+
return -ENOMEM;
457457
}
458458

459459
length = name_show(&edev->dev, NULL, prop_buf);

0 commit comments

Comments
 (0)