Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1381340imm; Sat, 4 Aug 2018 02:13:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpevoAQbnmKHiEfMjaLvQIIRVBn9uZcDAqI0YCLl4NVszXJ5fwDs38unejWsE05GS5WpWnp8 X-Received: by 2002:a63:a919:: with SMTP id u25-v6mr7171788pge.211.1533374025588; Sat, 04 Aug 2018 02:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533374025; cv=none; d=google.com; s=arc-20160816; b=bXlRiNPh60teZJsi/KgD0q9d6FdYX0UWkC8MNFTATcAXhwyM2knA7qlF8eA4ECWdgK DqIUVmMprekLs0uAsJ4eABHdmC+kqrOL3Os4iRN1ADn1VQfT3sqIyKkm2n6nsv/uBVmZ Ve5qSKJf8XMQNxBPtKTnTZULgl6efc46AgXj3ZWEGf4Q5E0rsFuViJ3+sP0u5YPPPB+Q JCyHV8R1XxieLap8jyxiRVtFlema73H9C0qGZb4p5WI81h2DB6gt4f74eQFLZwyi0C1R kXp+dad/fpvxb9UbdkC0y9ONOLWsX/GEIPHD3V+CKP13rTJ9vlnv/ntRJ5xEuTV/jBIa xrGQ== 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=ehKvqZnS5tSAUsXlqmgoKt3Zo53R4bYxVK7leggnsq4=; b=LME42kEWvFcyjIvHo1sNMMu1zrK7J9D58MG84/GIYD/rHSwFzYjeuWymvP1f3n0lSE K3pztQsequYkSKoWq56dMNcWfbmACb/prRpGRonfXe1Dr6ZEdVs8A0giuhv48KZiA77U YQWff2xFI7Ws70sqta6IWgTg52W5h8+5E2BnBwCG9lAh96Ag4mpJrZkxRWfWhrfE3zG6 QN8jj4OYT1GDMeXhmsBeKY8ghJ4VtF//Yn8GUuxM2qSxrHX7Zc45DdAKM1icDwecsouC QiNXDuF8P36kpm9IyzNcBZPjajn4uJY2Dj6ktOUMq7HW8C26dYly1KzU4nRWAu5VWeJ3 KI9g== 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 c192-v6si7264840pfg.347.2018.08.04.02.13.31; Sat, 04 Aug 2018 02:13:45 -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 S2389319AbeHDLL6 (ORCPT + 99 others); Sat, 4 Aug 2018 07:11:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50348 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388576AbeHDLL5 (ORCPT ); Sat, 4 Aug 2018 07:11:57 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 97B4689C; Sat, 4 Aug 2018 09:11:56 +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.4 063/124] HID: i2c-hid: check if device is there before really probing Date: Sat, 4 Aug 2018 11:00:52 +0200 Message-Id: <20180804082704.857905539@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180804082702.434482435@linuxfoundation.org> References: <20180804082702.434482435@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.4-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 @@ -1017,6 +1017,14 @@ static int i2c_hid_probe(struct i2c_clie pm_runtime_set_active(&client->dev); pm_runtime_enable(&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;