public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] mctp i2c: initialise event handler read bytes
@ 2026-01-13  9:01 Matt Johnston
  2026-01-19 14:19 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Johnston @ 2026-01-13  9:01 UTC (permalink / raw)
  To: Jeremy Kerr, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Wolfram Sang
  Cc: netdev, linux-kernel, Andrew Jeffery, Matt Johnston

Set a 0xff value for i2c reads of an mctp-i2c device. Otherwise reads
will return "val" from the i2c bus driver. For i2c-aspeed and
i2c-npcm7xx that is a stack uninitialised u8.

Tested with "i2ctransfer -y 1 r10@0x34" where 0x34 is a mctp-i2c
instance, now it returns all 0xff.

Fixes: f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
---
I'm targeting net-next since this depends on the just-committed fix
from Jian Zhang 
ae4744e173fa ("net: mctp-i2c: fix duplicate reception of old data")

That patch and this one should both be applied to stable - will that
happen automatically with "Fixes:"?

Thanks,
Matt
---
 drivers/net/mctp/mctp-i2c.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
index ecda1cc36391ce50a6b28e6a9e13c3b344f8f993..8043b57bdf25095b3b4e6bacd3abbc6f8952acfe 100644
--- a/drivers/net/mctp/mctp-i2c.c
+++ b/drivers/net/mctp/mctp-i2c.c
@@ -243,7 +243,10 @@ static int mctp_i2c_slave_cb(struct i2c_client *client,
 
 	switch (event) {
 	case I2C_SLAVE_READ_REQUESTED:
+	case I2C_SLAVE_READ_PROCESSED:
+		/* MCTP I2C transport only uses writes */
 		midev->rx_pos = 0;
+		*val = 0xff;
 		break;
 	case I2C_SLAVE_WRITE_RECEIVED:
 		if (midev->rx_pos < MCTP_I2C_BUFSZ) {

---
base-commit: f10c325a345fef0a688a2bcdfab1540d1c924148
change-id: 20260113-mctp-read-fix-e191357ad049
prerequisite-message-id: <20260108101829.1140448-1-zhangjian.3032@bytedance.com>
prerequisite-patch-id: 0765450364f2e9f65f6f3940d4a45598763aae8c

Best regards,
-- 
Matt Johnston <matt@codeconstruct.com.au>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] mctp i2c: initialise event handler read bytes
  2026-01-13  9:01 [PATCH net-next] mctp i2c: initialise event handler read bytes Matt Johnston
@ 2026-01-19 14:19 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-19 14:19 UTC (permalink / raw)
  To: Matt Johnston
  Cc: jk, andrew+netdev, davem, edumazet, kuba, pabeni, wsa, netdev,
	linux-kernel, andrew

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 13 Jan 2026 17:01:16 +0800 you wrote:
> Set a 0xff value for i2c reads of an mctp-i2c device. Otherwise reads
> will return "val" from the i2c bus driver. For i2c-aspeed and
> i2c-npcm7xx that is a stack uninitialised u8.
> 
> Tested with "i2ctransfer -y 1 r10@0x34" where 0x34 is a mctp-i2c
> instance, now it returns all 0xff.
> 
> [...]

Here is the summary with links:
  - [net-next] mctp i2c: initialise event handler read bytes
    https://git.kernel.org/netdev/net-next/c/2a14e91b6d76

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-19 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13  9:01 [PATCH net-next] mctp i2c: initialise event handler read bytes Matt Johnston
2026-01-19 14:19 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox