Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1110941imm; Wed, 1 Aug 2018 10:21:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/NwmacEhgg+6Be0F2tZ+wcofV16+cTRZ0QjsZChQJdBK1ldw9iLEmW1dTdgVMW5i3Tpz5 X-Received: by 2002:a62:569c:: with SMTP id h28-v6mr27916504pfj.201.1533144080705; Wed, 01 Aug 2018 10:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144080; cv=none; d=google.com; s=arc-20160816; b=RFvGSllGdhAtIblNPq0BcupkWWO1j5oqxLMaQcxjDDnfeJ/ClVOgl4Yj5lk2Y+Yjmb 78HZGVfPLMSc1Jyt12I8dQc3uEZ/AJ06WnGWRnX1HzkMyu3g7tRr0z4A8RsswKrdGofW lScMg3FPWx1iSp52FyEHb9R8W1Ra3qub0IC2myX7RG7DSfKGlj9VDICUl7NYZXVEQq8a 9/cGEzBuOMM/th4G+qwsoc98E9t/TcxOWFgKQBUU0wcxujWg1+uCqF2vqkc1/25QHMtK rkbk7R+kxTwpyZMcOYOXYSiRBItAKNNHUAIjsiNjVRoU/zi4tUc5ca0VnfnN0qBrOhIo qQ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=m2zfogCjoHNnh6mdCFNW97ehjy6QaK0/ppimTgYOxkg=; b=LxXA+PdGF/yhxB1bXAKP+l8izKvks1Zw4sN80GOCmFVr8fLGR7l/hCiSAulMagsEBN Br0lAf5LeoxWT91A7j4pch1OjExDIX/eMBAZdSKcMwQlBEJ7FkzV8dKoXUJHYepPtSQ5 V67ME5mnSwwqE0LvXJTsL8QBSaLL+Im0qClq+gdmJZujh4O3+HiDvYaCI2clTIQeFzKU 4iq3l1VnXmPeSoeHgP2DMCyt3m4Bsilx/h45bCnuLeywTTJKEbRY7gQjr9x5LQc+B4V6 ZlWHI5TQ37XkILLW9Wcyv92EN8ZzafKvYxOj7vd1s5+EYu+cYS4PEN7EMROv/tdiXsT0 kMwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e3-v6si16479242pgc.85.2018.08.01.10.21.06; Wed, 01 Aug 2018 10:21:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405038AbeHATFb (ORCPT + 99 others); Wed, 1 Aug 2018 15:05:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47418 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404608AbeHATFb (ORCPT ); Wed, 1 Aug 2018 15:05:31 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5F68FCD1; Wed, 1 Aug 2018 17:18:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Benjamin Tissoires , Jiri Kosina , Sasha Levin Subject: [PATCH 4.14 140/246] HID: i2c-hid: check if device is there before really probing Date: Wed, 1 Aug 2018 18:50:50 +0200 Message-Id: <20180801165018.439817197@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit b3a81b6c4fc6730ac49e20d789a93c0faabafc98 ] On many Chromebooks touch devices are multi-sourced; the components are electrically compatible and one can be freely swapped for another without changing the OS image or firmware. To avoid bunch of scary messages when device is not actually present in the system let's try testing basic communication with it and if there is no response terminate probe early with -ENXIO. Signed-off-by: Dmitry Torokhov Reviewed-by: Benjamin Tissoires Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/hid/i2c-hid/i2c-hid.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -1036,6 +1036,14 @@ static int i2c_hid_probe(struct i2c_clie pm_runtime_enable(&client->dev); device_enable_async_suspend(&client->dev); + /* Make sure there is something at this address */ + ret = i2c_smbus_read_byte(client); + if (ret < 0) { + dev_dbg(&client->dev, "nothing at this address: %d\n", ret); + ret = -ENXIO; + goto err_pm; + } + ret = i2c_hid_fetch_hid_descriptor(ihid); if (ret < 0) goto err_pm;