mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: YoungJoon Lee <getfeus@gmail.com>
To: mitltlatltl@gmail.com, hansg@kernel.org, ilpo.jarvinen@linux.intel.com
Cc: bryan.odonoghue@linaro.org, platform-driver-x86@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] platform: arm64: huawei-gaokun-ec: Reject short I2C transfers
Date: Sat, 28 Nov 2026 04:06:56 -0500	[thread overview]
Message-ID: <CA+m4KrCviR01-RnsX2RkaCUr_iXHbQjObtdiUmRfZm8ooOGWYg@mail.gmail.com> (raw)
In-Reply-To: <CA+m4KrDv0-69kXyM-q3kK1O3dnbadWwDH=s+yH_7uEvVJsj2ow@mail.gmail.com>

gaokun_ec_request() issues a write followed by a read. If
i2c_transfer() completes zero messages, the helper logs a transfer
error but returns zero to its caller. If it completes just the write,
the helper returns one without having received a firmware status byte.

Return -EIO for a non-negative short count. Preserve the adapter's
negative errno, the EC status on a complete transfer, and the delay
before releasing the transaction lock.

Fixes: 7636f090d02e ("platform: arm64: add Huawei Matebook E Go EC driver")
Signed-off-by: Lee Youngjoon <getfeus@gmail.com>
---
 drivers/platform/arm64/huawei-gaokun-ec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c
b/drivers/platform/arm64/huawei-gaokun-ec.c
index ac21f732d..abf05e7ec 100644
--- a/drivers/platform/arm64/huawei-gaokun-ec.c
+++ b/drivers/platform/arm64/huawei-gaokun-ec.c
@@ -145,6 +145,8 @@ static int gaokun_ec_request(struct gaokun_ec *ec,
const u8 *req,
 	ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
 	if (ret != ARRAY_SIZE(msgs)) {
 		dev_err(&client->dev, "I2C transfer error %d\n", ret);
+		if (ret >= 0)
+			ret = -EIO;
 		goto out_after_break;
 	}

-- 
2.53.0



On Sat, 28 Nov 2026 04:06:44 -0500, YoungJoon Lee <getfeus@gmail.com> wrote:
> These two fixes address short I2C transfers and PAN ACK mask
> construction in the Huawei MateBook E Go EC driver.
>
> Changes in v2:
> - Patch 1 is unchanged.
> - Patch 2 validates against the two physical connectors, as suggested
>   by Pengyu Luo. The no-port-update sentinel still sends a zero mask.
>
> An I2C stub and UBSan verified the empty ACK, both valid masks,
> rejection of invalid indices without an I2C transfer, and short
> transfer handling. The series builds as an arm64 Image and EC module.
>
> OpenAI Codex assisted with source inspection, regression testing and
> drafting.
>
> Lee Youngjoon (2):
>   platform: arm64: huawei-gaokun-ec: Reject short I2C transfers
>   platform: arm64: huawei-gaokun-ec: Validate the PAN ACK bit index
>
>  drivers/platform/arm64/huawei-gaokun-ec.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
>
> base-commit: d4000e7b99e06e92f21a3c92098a0476d316e9d6
> --
> 2.53.0

  reply	other threads:[~2026-11-28  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  9:06 [PATCH v2 0/2] platform: arm64: huawei-gaokun-ec: Fix short transfers and PAN ACK masks YoungJoon Lee
2026-11-28  9:06 ` YoungJoon Lee [this message]
2026-11-28  9:06 ` [PATCH v2 2/2] platform: arm64: huawei-gaokun-ec: Validate the PAN ACK bit index YoungJoon Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+m4KrCviR01-RnsX2RkaCUr_iXHbQjObtdiUmRfZm8ooOGWYg@mail.gmail.com \
    --to=getfeus@gmail.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mitltlatltl@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®