From patchwork Tue Dec 24 03:51:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 182427 Delivered-To: patch@linaro.org Received: by 2002:a92:a146:0:0:0:0:0 with SMTP id v67csp1207275ili; Mon, 23 Dec 2019 19:52:57 -0800 (PST) X-Google-Smtp-Source: APXvYqykn3bvFxWAw9iV3UyaVgZetvJwdmRUQWDHpQL9FFXpFhMetnJuyax/rzFRygOj5izM7EN5 X-Received: by 2002:a9d:7315:: with SMTP id e21mr24030775otk.255.1577159577146; Mon, 23 Dec 2019 19:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577159577; cv=none; d=google.com; s=arc-20160816; b=lndTtthAGEqg+PFbcHm0MQBBQuWay0PI6BTPbbD69HEB0o3FrCN8lFCaGr5K62ZiRg 9iaGPZOOb8uWiF7lws//abjTyFn/5aChdv1eTwosoXu7kKV/L3bqPlaZCsKh7bSrKXET eZj4mV62a1NxjcNSpEHvpG4zo3LVSLgsDY1CW0f2cIG7hvQDQug4gm5CWbhgY/2J5AIw 2AC1hSaDew5dEk4NWOHgTuwKl5FP9T6qAR7G3ujqWv6POJF6L8sPLbt4pZcvgZKB5DEM V+eREzJue7ikYdeg/KF6M/1qVxZyTVdc/X9tJh5pyhZrZYO8Vd5nufZC8+PcSQt4tkKN 8rVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Wu6YA08f7oUpHxEarDeCploSruvCha1fJUKQLhzCAMU=; b=XKsEhVHmsYA5isLbE7nXGu96G7JAUkds7xV6KWb+Ns0s4HU4BxyWccK8EjXKFtIQ4o Vc4kj3jRGDDYql3edwLoVAdW/+ZiG2xG8VnihTJr+3n8feWnDH2BjgRn0bAuLy6Pi+W0 dYuiJyY0Yn4IWG2w1mJOPtzu4fkaHfaZAsn1HaUEdVoS1VEie1K4gfAUkjZLz6J6usA/ 2+0tDYIXRL+Y4dtbJplzJyPHrmVAZtbTzdJkVJFU13pKAFor71lClpKqLcoicn4zAO7U kYGhKFgH+oO/imIh44YrPkxINbbaSE1VUvbqru0g1dCJi5uyIc7ANxfHAlBpqHXuiqGs B9mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k21si5814608otr.1.2019.12.23.19.52.57 for ; Mon, 23 Dec 2019 19:52:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726832AbfLXDw4 (ORCPT ); Mon, 23 Dec 2019 22:52:56 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7737 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726747AbfLXDw4 (ORCPT ); Mon, 23 Dec 2019 22:52:56 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 99CE0BD3E0E93DEBEFC4; Tue, 24 Dec 2019 11:52:54 +0800 (CST) Received: from HGHY4L002753561.china.huawei.com (10.133.215.186) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Tue, 24 Dec 2019 11:52:45 +0800 From: Zhen Lei To: Jiri Kosina , Benjamin Tissoires , linux-usb , linux-input CC: Zhen Lei , Hillf Danton Subject: [PATCH 1/1] HID: hiddev: remove a duplicated check Date: Tue, 24 Dec 2019 11:51:17 +0800 Message-ID: <20191224035117.98816-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.133.215.186] X-CFilter-Loop: Reflected Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org After commit 9c09b214f30e ("HID: hiddev: avoid opening a disconnected device"), the original check "list->hiddev->exist" become unnecessary. Signed-off-by: Zhen Lei --- drivers/hid/usbhid/hiddev.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 1.8.3 diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index e421cdf2d1a4ec5..e04cf95fca094a8 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c @@ -292,16 +292,16 @@ static int hiddev_open(struct inode *inode, struct file *file) res = -ENODEV; goto bail_unlock; } - if (!list->hiddev->open++) - if (list->hiddev->exist) { - struct hid_device *hid = hiddev->hid; - res = hid_hw_power(hid, PM_HINT_FULLON); - if (res < 0) - goto bail_unlock; - res = hid_hw_open(hid); - if (res < 0) - goto bail_normal_power; - } + if (!list->hiddev->open++) { + struct hid_device *hid = hiddev->hid; + + res = hid_hw_power(hid, PM_HINT_FULLON); + if (res < 0) + goto bail_unlock; + res = hid_hw_open(hid); + if (res < 0) + goto bail_normal_power; + } mutex_unlock(&hiddev->existancelock); return 0; bail_normal_power: