Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1353805pxf; Fri, 26 Mar 2021 06:28:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpEzNueYjnKqIPzd5U5llIx2uQxm7dWjgpr8lqNrk9QEu5MS2AzrS2VwDXCt8Fi49rCkZN X-Received: by 2002:a17:906:3b99:: with SMTP id u25mr15441901ejf.277.1616765289825; Fri, 26 Mar 2021 06:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616765289; cv=none; d=google.com; s=arc-20160816; b=qmkaUZFNQhfnVf8lCP5UqzJUXJBNJpK33vzvB1uEirYedGlatTjzpGqdtQctTCKArW owECZ044I9+SitRrHaSgLHFlJKYaw191Sf5kYeYJYFKT6sDVPW/shrsfuxUXWhNdy3Co k5u7R/KsyUYgH6fvV08gWciDpozCvs+aVzVS9Wk71LR55OpVhXf0ustNAx456MqOAEMn XnUtLqYWi9Xg50ELXKE+aVLUOK/DBAb10hiDuXYDiVw7zmsvGA9FcmM2W20mrT+592hn xrQdX7hu2qtwhmgjCUqkCttan0NTnEIYNUg37FYUf6ysgcWhUOgF62QkEBjjxiOQs+uf mCXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=GV+IkmaeyVjfFxZtZKsjFDIv0K2oiUvswXjmilRzmbk=; b=n8uMu83tMBEH03RWLCNXZz8SwaovRgI6wMDb3w5pfd0urQO+enDF4jK8ICvP+yZrht qfxkMClnmnnWyR0XkYyANonXJ45TXmKVi0LECYtrieO6CLKUJUv7kyDyao9d0WBhqXTJ 5N6K+B7wmD2KAM148BL0rAZ3L6ighvMlvItwqRBbA7Ll9hMDInabDxUHMBVke/cigYE9 QacnTK0Kmxde6QWawSU+92VMrnLF6RkYtP8ZFO4U4aEmr4JNfJtk6N0NqWkaT7Z58niM f8AkJ81zgrFdEZXSW/tmUrmPPStJou6mUmjgIkhh6COLkEzEuuH178OkID8F9SfaodXC n/uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oQbfOtw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq7si6917433ejc.300.2021.03.26.06.27.46; Fri, 26 Mar 2021 06:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oQbfOtw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbhCZNYa (ORCPT + 99 others); Fri, 26 Mar 2021 09:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbhCZNY1 (ORCPT ); Fri, 26 Mar 2021 09:24:27 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD61C0613AA; Fri, 26 Mar 2021 06:24:26 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 15so7427103ljj.0; Fri, 26 Mar 2021 06:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=GV+IkmaeyVjfFxZtZKsjFDIv0K2oiUvswXjmilRzmbk=; b=oQbfOtw8lKNVyi0lhUdLntzpuMpE25nTvsHsmI0TCy9oeQlmJ1pEtzqiskM0X5i8/f q2HLzlaQpbsE0Bbn9QejWDuA46m9stYDR2QvNQo148WCziTXJys9+hDtKEAVXEAgge1v jWP3SNK/h1TLjC/l5UDwLc70W1ZmyawbsARg8Nql8ezynQ1cl22/Il6fdvhbCcqLUAN0 8YJPO3D3gf+VLQ88nScB5+ayIerEtH8jQJcyEV9n3fzXmMcYskUAsjT/GZCrN/5QzvWP jO8cse//nYZ61w6HOtZlb0PZ6lRU8muN3DYnD1fg0LMXh7QxoF0oOQsTM6tmX5ScqHG1 RnCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GV+IkmaeyVjfFxZtZKsjFDIv0K2oiUvswXjmilRzmbk=; b=icM5l0UBA0SkPaOVucP7GpMuEAC+SJFbLX/x5uVbPRrewu9EPueBGNJhTyjT5rO6H/ /RpIwh/JiUoyJOSu/iyqKMoUHljbSBa95t7neMkzvZt4YzH0Uoa2cQMMM2tmBBprTxhX Ms8ZL89DpJbLnK2x5+rXGLMTL+3Pyry8L+ijT7KaqzWqbUXUKFt2CNUKk0Brx4RrdinJ qLuYi9LTcEC2kSjiDLRg7PvbI1xk0Aru/Y0Qbu+BRaRDN+fvo28b9Y8mrCfhoYFp0Ixo hIzcsWFjLzbmvN5EO6QO1Lw+VJ3ceW1zt0LWziwW41YsqOImtf4LiO5gvDyGmzWl6D2z QEZQ== X-Gm-Message-State: AOAM530K6O9aSyTGt2oX4LBy/VQLJvqx7k5u9GTW3bUJFb1wzmyLOHJR i83hxunmbgGhtp7Mh77Q0YTNlSf0Z3U3/A== X-Received: by 2002:a2e:b4b4:: with SMTP id q20mr8918602ljm.45.1616765064911; Fri, 26 Mar 2021 06:24:24 -0700 (PDT) Received: from ?IPv6:2a00:1370:814d:99a9:a10:76ff:fe69:21b6? ([2a00:1370:814d:99a9:a10:76ff:fe69:21b6]) by smtp.googlemail.com with ESMTPSA id n25sm868961lfe.86.2021.03.26.06.24.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Mar 2021 06:24:24 -0700 (PDT) Subject: Re: [PATCH v1] Input: elants_i2c - fix division by zero if firmware reports zero phys size From: Dmitry Osipenko To: Dmitry Torokhov , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Johnny Chuang , Jasper Korten , Svyatoslav Ryhel Cc: linux-input@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210302100824.3423-1-digetx@gmail.com> Message-ID: Date: Fri, 26 Mar 2021 16:24:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210302100824.3423-1-digetx@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 02.03.2021 13:08, Dmitry Osipenko пишет: > Touchscreen firmware of ASUS Transformer TF700T reports zeros for the phys > size. Hence check whether the size is zero and don't set the resolution in > this case. > > Reported-by: Jasper Korten > Signed-off-by: Dmitry Osipenko > --- > > Please note that ASUS TF700T isn't yet supported by upstream kernel, > hence this is not a critical fix. > > drivers/input/touchscreen/elants_i2c.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c > index 4c2b579f6c8b..a2e1cc4192b0 100644 > --- a/drivers/input/touchscreen/elants_i2c.c > +++ b/drivers/input/touchscreen/elants_i2c.c > @@ -1441,14 +1441,16 @@ static int elants_i2c_probe(struct i2c_client *client, > > touchscreen_parse_properties(ts->input, true, &ts->prop); > > - if (ts->chip_id == EKTF3624) { > + if (ts->chip_id == EKTF3624 && ts->phy_x && ts->phy_y) { > /* calculate resolution from size */ > ts->x_res = DIV_ROUND_CLOSEST(ts->prop.max_x, ts->phy_x); > ts->y_res = DIV_ROUND_CLOSEST(ts->prop.max_y, ts->phy_y); > } > > - input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); > - input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); > + if (ts->x_res > 0) > + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res); > + if (ts->y_res > 0) > + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res); > if (ts->major_res > 0) > input_abs_set_res(ts->input, ABS_MT_TOUCH_MAJOR, ts->major_res); > > Hi, This is a very minor fix, but still will be nice if we could get it into 5.13 in order to have one less patch to care about. Thanks in advance!