Received: by 10.192.165.156 with SMTP id m28csp1139663imm; Wed, 11 Apr 2018 13:10:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx482OnyzvzfL2YR/KaDOiPgZUF5g4eKPmE4LW7f8NJB1wvxyjBptrsrwhM3ozzaPDVrXDbE/ X-Received: by 2002:a17:902:5381:: with SMTP id c1-v6mr6489143pli.234.1523477448303; Wed, 11 Apr 2018 13:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523477448; cv=none; d=google.com; s=arc-20160816; b=YXw1qOto3p/Iq5aPGsT/5QjkV9lQWJB9Zg6k2VJ1afgDUd09DSLE2z+zRGW60I86sj tDF76JLJe9thSN9z1floeQf3mDoO/5dTvr4oUZWmD3nfe0jm0Pvj3Rn2X3dj+jSQEU8R klFWXyDM/JhkNMKNQmZJxw6svU1rd/9T4uIAxJ+cNaQY7X25Np6dpwwa4LDuvHtyXRyJ jM94M1Q7/elJtVMwE8BhB7jpJvbNX71tBiRrW5qO3hM7drd2gp8LaZ7sAL2lAAUtkGkX LseULzlGdaVJw2tcy2xv6V4zd+VWF75juCIfAn6YYo2UDDwxEVZlu1+evYF+lmgOt/Io KOvA== 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=Akzedk+3ontuOjCIRb794fx3yyf1/dfpeFQHdVD4lmg=; b=VoB0+S7KwkJq03Y1kMvB8V2SWF/a3l1OgZgcxeU7ooM1BUxqBhMnsq1AgXsHcIOSb9 XP3NdX4eIUUeyKNbG0ajEeD/fHen3tVy2AmlYm664b771fZuviuK0FUgB79qLLU2Xfcx ZlkyVF5RYvkq3vfKEEoqePmiFQYjjr/V+wtaUWjs9wrPyaCL9Y4eqGiXx/xsUR7VjaAU yPg00t/wYPiEhKINH+CkOIJQ2XUE+XVdprbrY9En9Cc8iNQ21lfwf0ITMnoqMEiouii1 bZaAbiLiZq+y+ATkdWuLJBUfaYfQsmv1aZ2dz9EUW5uY7eVKF4ymwUO3TOZly6ycRHkK QoKg== 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 j70si1116676pgc.81.2018.04.11.13.10.11; Wed, 11 Apr 2018 13:10:48 -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 S933734AbeDKSzc (ORCPT + 99 others); Wed, 11 Apr 2018 14:55:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35418 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932962AbeDKSz2 (ORCPT ); Wed, 11 Apr 2018 14:55:28 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 91FEB99F; Wed, 11 Apr 2018 18:55:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.9 033/310] Input: elan_i2c - check if device is there before really probing Date: Wed, 11 Apr 2018 20:32:52 +0200 Message-Id: <20180411183623.702032725@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit c5928551fd41b2eecdad78fa2be2a4a13ed5fde9 ] Before trying to properly initialize the touchpad and generate bunch of errors, let's first see it there is anything at the given address. If we get error, fail silently with -ENXIO. Reviewed-by: Guenter Roeck Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/elan_i2c_core.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1082,6 +1082,13 @@ static int elan_probe(struct i2c_client return error; } + /* Make sure there is something at this address */ + error = i2c_smbus_read_byte(client); + if (error < 0) { + dev_dbg(&client->dev, "nothing at this address: %d\n", error); + return -ENXIO; + } + /* Initialize the touchpad. */ error = elan_initialize(data); if (error)