Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp234983pxb; Wed, 15 Sep 2021 00:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI//NidPt2GpyD5HNPFmJMJE0pq9ze94DGPgF1VU+vpmPukGs0yve0NYo6VqYsMFKiHKme X-Received: by 2002:a2e:a37a:: with SMTP id i26mr18395124ljn.466.1631690633281; Wed, 15 Sep 2021 00:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631690633; cv=none; d=google.com; s=arc-20160816; b=XZxVT25Oj30g70PhHV7MN6r/KQBg/45RylXZpOhCZroA1YF0poUB0Js8MhUjRgCkOj YgR8g8+4HtPTx3DGTHGBzEukM6evA45paQF+SpanGKemSJ53PV73FOgZBY756niLb/9L a5TlVO0mONu9srYADQ2R+ocCQRhdF/szAF3yDZUQvaNqrssWB/65mwaXykTc2TK13JAV BTa3VbOYyqb3ubzNLTAkaGUKR7pEKMAZtdsFbXBv4PUYHvPvdZHB/mJ2i0ysgYKjqjaJ mfO/BIrqzt15NvnNpzq9Q1od2v89H6UmmQsAFBsAzBoVlcYY9buIRPLmZMdNcWLjMKv9 YOUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=3bEVmzbTPYR6F4pgEIGlx8jotn1p4ZV6DBNVfAqBS/U=; b=MwwFtPVRyk8zMSc4Py8TLD+tvhE6QtkHgDjKsARVEwDG/ciOWQvXMV+XBWbUXyfvjf ebQuOhV+UiOm5yrXNjrgj4Q3Fca0rOW2IsRp9kQpbxieq+sZ+fRUAU9zB7yG/ZAMrHsR HwHxc+YlLWI8IDkhZr1WkWbMOGP2kZE7wO0Bmld6XTY32HahQZiPW+2IP+eBjT5XgGAa B2HrDb9aQneSKwgiDkEsxuq1odTC096c2xU9UT2MUTD5lDsgvTLDl6VgA+9Eir4f9DEM k1eeJmMk7UG+bUW70GW6y55HI8QzMc3/hMt1FTFm2mPFKqZ8P4rd9c8y18QcEkbF2frA x4pg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si16040130ljg.513.2021.09.15.00.22.58; Wed, 15 Sep 2021 00:23:53 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231459AbhIOHVb (ORCPT + 99 others); Wed, 15 Sep 2021 03:21:31 -0400 Received: from mga12.intel.com ([192.55.52.136]:7618 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbhIOHVb (ORCPT ); Wed, 15 Sep 2021 03:21:31 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="201746275" X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="201746275" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 00:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,294,1624345200"; d="scan'208";a="610052812" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 15 Sep 2021 00:20:10 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 15 Sep 2021 10:20:09 +0300 Date: Wed, 15 Sep 2021 10:20:09 +0300 From: Heikki Krogerus To: Sven Peter Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] usb: typec: tipd: Don't read/write more bytes than required Message-ID: References: <20210914140235.65955-1-sven@svenpeter.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210914140235.65955-1-sven@svenpeter.dev> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 04:02:33PM +0200, Sven Peter wrote: > 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 Reviewed-by: Heikki Krogerus > --- > 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 thanks, -- heikki