Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752757AbcLCI5J (ORCPT ); Sat, 3 Dec 2016 03:57:09 -0500 Received: from m50-132.163.com ([123.125.50.132]:42518 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbcLCI5I (ORCPT ); Sat, 3 Dec 2016 03:57:08 -0500 From: Pan Bian To: MyungJoo Ham , Chanwoo Choi Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] extcon: return error code on failure Date: Sat, 3 Dec 2016 16:56:49 +0800 Message-Id: <1480755409-3022-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowADXu+zWiEJY+YMGIQ--.7546S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZr4DurWDGFyxCFWDXrykuFg_yoWDGrgE93 y8Zr43Xrn7KrW2y3WkC3yayryIkF15Xrn5u3Z0vryfXryUCw4qyF1kXrn8Zr4UZwsavF1q 9wn5Wry5ZryrXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeDPE3UUUUU== X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQAE0clSIRRferQABs7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 946 Lines: 29 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 --- drivers/extcon/extcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 1.9.1