Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp705224pxb; Tue, 14 Sep 2021 07:04:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0bS8El1WDqtjC/n8u/UUSci6UZuRJaRqmMYni/OHrlPAmv1Ewj65JRuaYKi1hdh30c6QO X-Received: by 2002:a05:6e02:2148:: with SMTP id d8mr8373652ilv.305.1631628263256; Tue, 14 Sep 2021 07:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631628263; cv=none; d=google.com; s=arc-20160816; b=idnYAlzPj5lCk9LVmXwO414day8fob7fxE6EEZj4pJgbUYXg4KQFUuz2VHCfyWDolK Bh4Nzu/1CUlPLas9WBrpzxzIL+NN1rUGIljuXYzweQDqBtBSyc2vo3ZgkgnXonen9Gji Ice/JEKiYRHAF0wr4bNU5emb+K5D0oxB49+DEKW6KNp3nPAsICyWCwqEt8hzehuIQWCh udX5j66aJpRzC8CZVrJRNsY8CrEbpLBDfeLcmRPr3PKNt5ns6gbC/yjmMQFrACjNtz7n aOlBHwJZytNy5UoaVD+Urp7ni1xeAP5wt9LDi4mS6HO3uz/Z1Of7AcvU1ItqvyV7xZKN nv3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=0ZwXiZhi1QvrQjegd1Fbj2eOT8sE6gEZauag+r4fBZA=; b=ehmOuWtt9S5RMJemruGO2HqupcYChjKLVbxS0O+CSm5r4vr55BCG6KyOpbx+qzbNGI qh8bqqZICjeNvmtkYODbwQEnGsgYYmzA8djiN3qYBYRERD3T0NCeur2zMRlOJG/t/cDM /TNEDco0lDl7pp9MMxjORK/YKpLQuLXvVoDg8bZhR/3UKYzw8pcUEVySiY+m3flcxHxE t1TAEhAAT/WYlTD38Nij4DhfsgLHa4wRbHr0FHsmFNad2EAITYkIYMLvQSBTXWh+SgSb zC+aX6yHNq7tIEq+C2Ges2tEhO8Vj/AlKK0tLHoPgOQ3i0B/UIIXXKTq/EFL6TkS568/ tXTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm2 header.b="mVl9l/js"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=A679T0hg; 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=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si11873584jat.52.2021.09.14.07.04.05; Tue, 14 Sep 2021 07:04:23 -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=@svenpeter.dev header.s=fm2 header.b="mVl9l/js"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=A679T0hg; 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=REJECT sp=REJECT dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233538AbhINOEE (ORCPT + 99 others); Tue, 14 Sep 2021 10:04:04 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48053 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbhINOED (ORCPT ); Tue, 14 Sep 2021 10:04:03 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CACFB5C0115; Tue, 14 Sep 2021 10:02:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 14 Sep 2021 10:02:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=0ZwXiZhi1QvrQjegd1Fbj2eOT8 sE6gEZauag+r4fBZA=; b=mVl9l/jsH6bPWuum34e9qxaaD/1Yo6p81jAOnw8kwe IlPgSIvCurASBPi0xbYYL3HdCJxNbfKV6+uObiRacQaGhI9oG8Yk+yu7svb4EgDn Ea+t1uaXPSPEndcxQBv6IekBCE73P5yQ7cFDCNConFB05ivphgioj0p8OgVLh2cI VcUTBirLnZNIEnIlzjxnMdsiWPGnd5JPlCYdl8SqK0z/qdMSBcSBwAEAFK5u64ju yqkHvRpePbqVP57AGR3GCogzHzjnqynvi77dWRaI1ZXcC4tXfNpv4cax6v29Goja H5REoeNQr7JT+AxKbxaS6+P+lxoMf5jBDDDUP2Q65rdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=0ZwXiZhi1QvrQjegd 1Fbj2eOT8sE6gEZauag+r4fBZA=; b=A679T0hg++tIr+hMnYrzytIOG3tVb/J7N saPp90aCdxt/J952eDfJKpfWYz6r3TERfIK4qWVW1fqfxzvQ1XR+GxM+QjuQZpZr XkzRjbYq2R40cUWFlvLIQp3Y1v3R3cf6B1ry7lT6JUzxWvqozyLszm7aDTLmw79/ HU0GHKe8U9LIglm/MrNzGAY/vZpXjrt7xfgjTnZnjqeA0LjBfTz8uAC4UO5gSMEs HLW1NTGZHzCpL49d0Op/beiEDG2t+znnTPvoTFfbyriJPWd/wXOrtd6PK0xpCOtD DkYGlXknNT/pL+Ea0OVrDhwFHcmBcoiOC/KO47lcFW/7HGK4yCbwg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudegledgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epuefgleekvddtjefffeejheevleefveekgfduudfhgefhfeegtdehveejfefffffgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Sep 2021 10:02:44 -0400 (EDT) From: Sven Peter To: Heikki Krogerus Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Sven Peter Subject: [PATCH v2 1/3] usb: typec: tipd: Don't read/write more bytes than required Date: Tue, 14 Sep 2021 16:02:33 +0200 Message-Id: <20210914140235.65955-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tps6598x_block_read/write always read 65 bytes of data even when much less is required when I2C_FUNC_I2C is used. Reduce this to the correct number. Signed-off-by: Sven Peter --- no changes for v2 drivers/usb/typec/tipd/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 21b3ae25c76d..c18ec3785592 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -123,7 +123,7 @@ tps6598x_block_read(struct tps6598x *tps, u8 reg, void *val, size_t len) if (!tps->i2c_protocol) return regmap_raw_read(tps->regmap, reg, val, len); - ret = regmap_raw_read(tps->regmap, reg, data, sizeof(data)); + ret = regmap_raw_read(tps->regmap, reg, data, len + 1); if (ret) return ret; @@ -145,7 +145,7 @@ static int tps6598x_block_write(struct tps6598x *tps, u8 reg, data[0] = len; memcpy(&data[1], val, len); - return regmap_raw_write(tps->regmap, reg, data, sizeof(data)); + return regmap_raw_write(tps->regmap, reg, data, len + 1); } static inline int tps6598x_read16(struct tps6598x *tps, u8 reg, u16 *val) -- 2.25.1