Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751572AbcLDFKu (ORCPT ); Sun, 4 Dec 2016 00:10:50 -0500 Received: from m50-132.163.com ([123.125.50.132]:43015 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750697AbcLDFKr (ORCPT ); Sun, 4 Dec 2016 00:10:47 -0500 From: Pan Bian To: Jiri Kosina , Benjamin Tissoires , linux-usb@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] input: usbhid: fix improper check Date: Sun, 4 Dec 2016 13:10:09 +0800 Message-Id: <1480828209-4131-1-git-send-email-bianpan201603@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowACHle1EpUNYO2WlIQ--.23836S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrtr48ZF1kAF43Gr45tr43ZFb_yoWkJFXEg3 yUWa9rJr18Gw1xCr4UC3y7Zry3KayDZFn3WF1ftws3Zry2q347ZFZ2vrn8GF18Wr9rXa4k CFsaqF43Cr9rJjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUYrEf5UUUUU== X-Originating-IP: [114.243.30.33] X-CM-SenderInfo: held01tdqsiiqwqtqiywtou0bp/1tbiSAo291XlhBZ0mgAAsP Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1057 Lines: 31 From: Pan Bian Function hid_post_reset() returns 0 on success, or 1 on failures. However, in function hid_reset_resume(), uses "status >= 0" to check the return value of hid_post_reset(). Obviously, the condition will always be satisfied. This patch fixes the bug, uses "status == 0" to check the return value. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188921 Signed-off-by: Pan Bian --- drivers/hid/usbhid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index ae83af6..3639b70 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1590,7 +1590,7 @@ static int hid_reset_resume(struct usb_interface *intf) int status; status = hid_post_reset(intf); - if (status >= 0 && hid->driver && hid->driver->reset_resume) { + if (status == 0 && hid->driver && hid->driver->reset_resume) { int ret = hid->driver->reset_resume(hid); if (ret < 0) status = ret; -- 1.9.1