Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v6 00/10] Congatec Board Controller: Add storage devices support
@ 2026-11-17  9:47 Thomas Richard (congatec GmbH)
  2026-11-17  9:47 ` [PATCH v6 01/10] mfd: cgbc: Fix use of negative error code as valid session handle Thomas Richard (congatec GmbH)
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Thomas Richard (congatec GmbH) @ 2026-11-17  9:47 UTC (permalink / raw)
  To: Lee Jones, Andi Shyti
  Cc: Thomas Petazzoni, Werner Gartner, mfd, linux-kernel, linux-i2c,
	Thomas Richard (congatec GmbH), stable, Sashiko

This is the 6th iteration. As discussed with Lee [1] I just picked his I2C
patch [2] (to handle the conflict) and rebased the series on top of
next-20261116.

[1] https://lore.kernel.org/all/c9d26395-93f8-4e63-9cd0-586ce913931b@bootlin.com/
[2] https://lore.kernel.org/all/20261027093306.2812695-27-lee@kernel.org/

Best Regards,
Thomas

Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
---
Changes in v6:
- rebased on top of next-20261116.
- add Lee's I2C patch (PATCH 2).
- Link to v5: https://patch.msgid.link/20261103-cgbc-i2c-storage-devices-support-v5-0-ac11f23fae51@bootlin.com

Changes in v5:
- mfd: fix error message in case we fail to get session handle.
- fix I2C bus names earlier in the series.
- Link to v4: https://patch.msgid.link/20261002-cgbc-i2c-storage-devices-support-v4-0-eb42e0f1df59@bootlin.com

Changes in v4:
- Fix struct cgbc_i2c_platform_data comment (kernel-doc warning)
- Move struct cgbc_i2c_platform_data from linux/platform_data/i2c-cgbc.h to
  linux/mfd/cgbc.h
- Use MFD_CELL_NAME macros.
- Link to v3: https://patch.msgid.link/20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com

Changes in v3:
- rebased on v7.3-rc2
- use PLATFORM_DEVID_AUTO for child devices
- move I2C bus and I2C device definition in the MFD driver
- Link to v2: https://patch.msgid.link/20260811-cgbc-i2c-storage-devices-support-v2-0-3efa998e0ef5@bootlin.com

Changes in v2:
- i2c: fix typo in CGBC BIOS EEPROM label.
- mfd: make cgbc_devs const
- Link to v1: https://patch.msgid.link/20260804-cgbc-i2c-storage-devices-support-v1-0-fed38510671c@bootlin.com

To: Thomas Richard <thomas.richard@bootlin.com>
To: Lee Jones <lee@kernel.org>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Werner Gartner <Werner.Gartner@congatec.com>
Cc: mfd@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
Cc: linux-i2c@vger.kernel.org

---
Lee Jones (1):
      i2c: cgbc: Propagate hardware errors when polling read status

Thomas Richard (congatec GmbH) (9):
      mfd: cgbc: Fix use of negative error code as valid session handle
      i2c: cgbc: Use real I2C bus names
      mfd: cgbc: Add I2C platform data
      i2c: cgbc: Use plateform data to get bus ID and adapter name
      mfd: cgbc: Use PLATFORM_DEVID_AUTO for child device registration
      i2c: cgbc: Add support for fixed frequency buses
      mfd: cgbc: Add virtual I2C bus support
      mfd: cgbc: Add virtual storage devices on the virtual I2C bus
      i2c: cgbc: Register known I2C devices on the bus

 drivers/i2c/busses/i2c-cgbc.c | 135 ++++++++++++++++--------------
 drivers/mfd/cgbc-core.c       | 187 +++++++++++++++++++++++++++++++++++++++---
 include/linux/mfd/cgbc.h      |  16 ++++
 3 files changed, 265 insertions(+), 73 deletions(-)
---
base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
change-id: 20260717-cgbc-i2c-storage-devices-support-b3ee7cea3320

Best regards,
--  
Best Regards,
Thomas Richard


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

* [PATCH v6 01/10] mfd: cgbc: Fix use of negative error code as valid session handle
  2026-11-17  9:47 [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
@ 2026-11-17  9:47 ` Thomas Richard (congatec GmbH)
  2026-11-17  9:47 ` [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status Thomas Richard (congatec GmbH)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Thomas Richard (congatec GmbH) @ 2026-11-17  9:47 UTC (permalink / raw)
  To: Lee Jones, Andi Shyti
  Cc: Thomas Petazzoni, Werner Gartner, mfd, linux-kernel, linux-i2c,
	Thomas Richard (congatec GmbH), stable, Sashiko

The cgbc_session_command() return value was directly cast to u8 and used
as session handle without error checking. Casting a negative error to u8
produces a valid-looking session handle. So check if return value is
positive before to cast and use it.

Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260713-cgbc-core-fix-cgbc-remove-v1-1-79274ad62b3a%40bootlin.com?part=1
Fixes: 6f1067cfbee7 ("mfd: Add Congatec Board Controller driver")
Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
---
 drivers/mfd/cgbc-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
index 8a63923d1912..1d5c99a38e85 100644
--- a/drivers/mfd/cgbc-core.c
+++ b/drivers/mfd/cgbc-core.c
@@ -103,7 +103,12 @@ static int cgbc_session_request(struct cgbc_device_data *cgbc)
 	if (ret)
 		return dev_err_probe(cgbc->dev, ret, "device not found or not ready\n");
 
-	cgbc->session = cgbc_session_command(cgbc, CGBC_SESSION_CMD_REQUEST);
+	ret = cgbc_session_command(cgbc, CGBC_SESSION_CMD_REQUEST);
+	if (ret < 0)
+		return dev_err_probe(cgbc->dev, ret,
+				     "failed to start a session with the Board Controller\n");
+
+	cgbc->session = ret;
 
 	/* The Board Controller sent us a wrong session handle, we cannot communicate with it */
 	if (cgbc->session < CGBC_SESSION_VALID_MIN || cgbc->session > CGBC_SESSION_VALID_MAX)

-- 
2.53.0


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

* [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status
  2026-11-17  9:47 [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
  2026-11-17  9:47 ` [PATCH v6 01/10] mfd: cgbc: Fix use of negative error code as valid session handle Thomas Richard (congatec GmbH)
@ 2026-11-17  9:47 ` Thomas Richard (congatec GmbH)
  2026-11-26 13:34   ` Andi Shyti
  2026-11-17  9:47 ` [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
  2026-11-19 19:03 ` [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Lee Jones
  3 siblings, 1 reply; 11+ messages in thread
From: Thomas Richard (congatec GmbH) @ 2026-11-17  9:47 UTC (permalink / raw)
  To: Lee Jones, Andi Shyti
  Cc: Thomas Petazzoni, Werner Gartner, mfd, linux-kernel, linux-i2c,
	Thomas Richard (congatec GmbH), stable

From: Lee Jones <lee@kernel.org>

In cgbc_i2c_xfer_msg(), read_poll_timeout() uses the same ret variable
to store the polled return value of cgbc_i2c_get_status() and the
timeout result of the macro itself.  When cgbc_i2c_get_status() returns
a negative error code (such as -EIO on an I2C NACK), the loop condition
ret != CGBC_I2C_STAT_BUSY evaluates to true and read_poll_timeout()
overwrites ret with 0.  The driver then issues CGBC_I2C_CMD_DATA, which
completes with CGBC_STATUS_CMD_READY without populating msg->buf,
leaving uninitialised heap memory in the caller's read buffer.

Store the polled status in a separate variable, verify that it equals
CGBC_I2C_STAT_DAT, and check that CGBC_I2C_CMD_DATA returns the expected
number of bytes.

Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
Closes: https://sashiko.dev/#/bug/linux-66cbf4b1-a219-4012-969d-236417bf419a
Cc: stable@vger.kernel.org
Reviewed-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
Tested-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
---
 drivers/i2c/busses/i2c-cgbc.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c
index 164be9b99eb3..dfdb9ffc6447 100644
--- a/drivers/i2c/busses/i2c-cgbc.c
+++ b/drivers/i2c/busses/i2c-cgbc.c
@@ -205,9 +205,9 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap)
 	struct cgbc_device_data *cgbc = i2c->cgbc;
 	struct i2c_msg *msg = i2c->msg;
 	u8 cmd[CGBC_I2C_CMD_SIZE];
-	int ret, max_len, len, i;
+	int ret, status, max_len, len, i;
 	unsigned int cmd_len;
-	u8 cmd_data;
+	u8 cmd_data, data_len;
 
 	struct cgbc_i2c_transfer xfer = {
 		.bus_id = algo_data->bus_id,
@@ -266,17 +266,32 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap)
 		if (ret)
 			goto err;
 
-		ret = read_poll_timeout(cgbc_i2c_get_status, ret,
-					ret != CGBC_I2C_STAT_BUSY, 0,
+		ret = read_poll_timeout(cgbc_i2c_get_status, status,
+					status != CGBC_I2C_STAT_BUSY, 0,
 					2 * algo_data->read_maxtime_us, false, adap);
-		if (ret < 0)
+		if (ret)
+			goto err;
+
+		if (status < 0) {
+			ret = status;
 			goto err;
+		}
+
+		if (status != CGBC_I2C_STAT_DAT) {
+			ret = -EIO;
+			goto err;
+		}
 
 		cmd_data = CGBC_I2C_CMD_DATA | algo_data->bus_id;
 		ret = cgbc_command(cgbc, &cmd_data, sizeof(cmd_data),
-				   msg->buf + i2c->pos, len, NULL);
+				   msg->buf + i2c->pos, len, &data_len);
 		if (ret)
 			goto err;
+
+		if (data_len != len) {
+			ret = -EIO;
+			goto err;
+		}
 	}
 
 	if (len == (msg->len - i2c->pos)) {

-- 
2.53.0


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

* [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names
  2026-11-17  9:47 [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
  2026-11-17  9:47 ` [PATCH v6 01/10] mfd: cgbc: Fix use of negative error code as valid session handle Thomas Richard (congatec GmbH)
  2026-11-17  9:47 ` [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status Thomas Richard (congatec GmbH)
@ 2026-11-17  9:47 ` Thomas Richard (congatec GmbH)
  2026-11-26 12:54   ` Andi Shyti
  2026-11-26 13:41   ` Andi Shyti
  2026-11-19 19:03 ` [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Lee Jones
  3 siblings, 2 replies; 11+ messages in thread
From: Thomas Richard (congatec GmbH) @ 2026-11-17  9:47 UTC (permalink / raw)
  To: Lee Jones, Andi Shyti
  Cc: Thomas Petazzoni, Werner Gartner, mfd, linux-kernel, linux-i2c,
	Thomas Richard (congatec GmbH), stable

The adapter names described the expected purpose of the buses ("General
Purpose I2C adapter", "Power Management I2C adapter") on conga-sa7 board
rather than their actual names on the Board Controller.

Rename them to the real bus names "cgbc-i2c0" and "cgbc-ddc0", matching
the naming used by Congatec.

Cc: stable@vger.kernel.org
Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
---
 drivers/i2c/busses/i2c-cgbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c
index dfdb9ffc6447..baf02bfe090c 100644
--- a/drivers/i2c/busses/i2c-cgbc.c
+++ b/drivers/i2c/busses/i2c-cgbc.c
@@ -358,7 +358,7 @@ static struct i2c_algo_cgbc_data cgbc_i2c_algo_data[] = {
 static const struct i2c_adapter cgbc_i2c_adapter[] = {
 	{
 		.owner		= THIS_MODULE,
-		.name		= "Congatec General Purpose I2C adapter",
+		.name		= "cgbc-i2c0",
 		.class		= I2C_CLASS_DEPRECATED,
 		.algo		= &cgbc_i2c_algorithm,
 		.algo_data	= &cgbc_i2c_algo_data[0],
@@ -366,7 +366,7 @@ static const struct i2c_adapter cgbc_i2c_adapter[] = {
 	},
 	{
 		.owner		= THIS_MODULE,
-		.name		= "Congatec Power Management I2C adapter",
+		.name		= "cgbc-ddc0",
 		.class		= I2C_CLASS_DEPRECATED,
 		.algo		= &cgbc_i2c_algorithm,
 		.algo_data	= &cgbc_i2c_algo_data[1],

-- 
2.53.0


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

* Re: [PATCH v6 00/10] Congatec Board Controller: Add storage devices support
  2026-11-17  9:47 [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
                   ` (2 preceding siblings ...)
  2026-11-17  9:47 ` [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
@ 2026-11-19 19:03 ` Lee Jones
  2026-11-19 19:11   ` Thomas Richard
  2026-11-26 10:24   ` Thomas Richard
  3 siblings, 2 replies; 11+ messages in thread
From: Lee Jones @ 2026-11-19 19:03 UTC (permalink / raw)
  To: Thomas Richard (congatec GmbH)
  Cc: Andi Shyti, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable, Sashiko

On Tue, 17 Nov 2026, Thomas Richard (congatec GmbH) wrote:

> This is the 6th iteration. As discussed with Lee [1] I just picked his I2C
> patch [2] (to handle the conflict) and rebased the series on top of
> next-20261116.
> 
> [1] https://lore.kernel.org/all/c9d26395-93f8-4e63-9cd0-586ce913931b@bootlin.com/
> [2] https://lore.kernel.org/all/20261027093306.2812695-27-lee@kernel.org/

I assume this all needs to go in at once?

So we just need the I2C Acks, then I can take the set and send out a PR.

> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
> ---
> Changes in v6:
> - rebased on top of next-20261116.
> - add Lee's I2C patch (PATCH 2).
> - Link to v5: https://patch.msgid.link/20261103-cgbc-i2c-storage-devices-support-v5-0-ac11f23fae51@bootlin.com
> 
> Changes in v5:
> - mfd: fix error message in case we fail to get session handle.
> - fix I2C bus names earlier in the series.
> - Link to v4: https://patch.msgid.link/20261002-cgbc-i2c-storage-devices-support-v4-0-eb42e0f1df59@bootlin.com
> 
> Changes in v4:
> - Fix struct cgbc_i2c_platform_data comment (kernel-doc warning)
> - Move struct cgbc_i2c_platform_data from linux/platform_data/i2c-cgbc.h to
>   linux/mfd/cgbc.h
> - Use MFD_CELL_NAME macros.
> - Link to v3: https://patch.msgid.link/20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com
> 
> Changes in v3:
> - rebased on v7.3-rc2
> - use PLATFORM_DEVID_AUTO for child devices
> - move I2C bus and I2C device definition in the MFD driver
> - Link to v2: https://patch.msgid.link/20260811-cgbc-i2c-storage-devices-support-v2-0-3efa998e0ef5@bootlin.com
> 
> Changes in v2:
> - i2c: fix typo in CGBC BIOS EEPROM label.
> - mfd: make cgbc_devs const
> - Link to v1: https://patch.msgid.link/20260804-cgbc-i2c-storage-devices-support-v1-0-fed38510671c@bootlin.com
> 
> To: Thomas Richard <thomas.richard@bootlin.com>
> To: Lee Jones <lee@kernel.org>
> To: Andi Shyti <andi.shyti@kernel.org>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Werner Gartner <Werner.Gartner@congatec.com>
> Cc: mfd@lists.linux.dev
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-i2c@vger.kernel.org
> 
> ---
> Lee Jones (1):
>       i2c: cgbc: Propagate hardware errors when polling read status
> 
> Thomas Richard (congatec GmbH) (9):
>       mfd: cgbc: Fix use of negative error code as valid session handle
>       i2c: cgbc: Use real I2C bus names
>       mfd: cgbc: Add I2C platform data
>       i2c: cgbc: Use plateform data to get bus ID and adapter name
>       mfd: cgbc: Use PLATFORM_DEVID_AUTO for child device registration
>       i2c: cgbc: Add support for fixed frequency buses
>       mfd: cgbc: Add virtual I2C bus support
>       mfd: cgbc: Add virtual storage devices on the virtual I2C bus
>       i2c: cgbc: Register known I2C devices on the bus
> 
>  drivers/i2c/busses/i2c-cgbc.c | 135 ++++++++++++++++--------------
>  drivers/mfd/cgbc-core.c       | 187 +++++++++++++++++++++++++++++++++++++++---
>  include/linux/mfd/cgbc.h      |  16 ++++
>  3 files changed, 265 insertions(+), 73 deletions(-)
> ---
> base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4
> change-id: 20260717-cgbc-i2c-storage-devices-support-b3ee7cea3320
> 
> Best regards,
> --  
> Best Regards,
> Thomas Richard
> 

-- 
Lee Jones

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

* Re: [PATCH v6 00/10] Congatec Board Controller: Add storage devices support
  2026-11-19 19:03 ` [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Lee Jones
@ 2026-11-19 19:11   ` Thomas Richard
  2026-11-26 10:24   ` Thomas Richard
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Richard @ 2026-11-19 19:11 UTC (permalink / raw)
  To: Lee Jones
  Cc: Andi Shyti, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable, Sashiko

On 11/19/26 8:03 PM, Lee Jones wrote:
> On Tue, 17 Nov 2026, Thomas Richard (congatec GmbH) wrote:
> 
>> This is the 6th iteration. As discussed with Lee [1] I just picked his I2C
>> patch [2] (to handle the conflict) and rebased the series on top of
>> next-20261116.
>>
>> [1] https://lore.kernel.org/all/c9d26395-93f8-4e63-9cd0-586ce913931b@bootlin.com/
>> [2] https://lore.kernel.org/all/20261027093306.2812695-27-lee@kernel.org/
> 
> I assume this all needs to go in at once?

Yes please.

Best Regards,
Thomas

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

* Re: [PATCH v6 00/10] Congatec Board Controller: Add storage devices support
  2026-11-19 19:03 ` [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Lee Jones
  2026-11-19 19:11   ` Thomas Richard
@ 2026-11-26 10:24   ` Thomas Richard
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Richard @ 2026-11-26 10:24 UTC (permalink / raw)
  To: Lee Jones, Andi Shyti
  Cc: Thomas Petazzoni, Werner Gartner, mfd, linux-kernel, linux-i2c,
	stable, Sashiko

On 11/19/26 8:03 PM, Lee Jones wrote:
> On Tue, 17 Nov 2026, Thomas Richard (congatec GmbH) wrote:
> 
>> This is the 6th iteration. As discussed with Lee [1] I just picked his I2C
>> patch [2] (to handle the conflict) and rebased the series on top of
>> next-20261116.
>>
>> [1] https://lore.kernel.org/all/c9d26395-93f8-4e63-9cd0-586ce913931b@bootlin.com/
>> [2] https://lore.kernel.org/all/20261027093306.2812695-27-lee@kernel.org/
> 
> I assume this all needs to go in at once?
> 
> So we just need the I2C Acks, then I can take the set and send out a PR.

Hi Andi,

Could you have a look to the I2C patches, Lee is waiting your ack to
apply the series in his tree.

Best Regards,
Thomas

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

* Re: [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names
  2026-11-17  9:47 ` [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
@ 2026-11-26 12:54   ` Andi Shyti
  2026-11-26 13:41   ` Andi Shyti
  1 sibling, 0 replies; 11+ messages in thread
From: Andi Shyti @ 2026-11-26 12:54 UTC (permalink / raw)
  To: Thomas Richard (congatec GmbH)
  Cc: Lee Jones, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable

Hi Thomas,

On Tue, Nov 17, 2026 at 10:47:43AM +0100, Thomas Richard (congatec GmbH) wrote:
> The adapter names described the expected purpose of the buses ("General
> Purpose I2C adapter", "Power Management I2C adapter") on conga-sa7 board
> rather than their actual names on the Board Controller.
> 
> Rename them to the real bus names "cgbc-i2c0" and "cgbc-ddc0", matching
> the naming used by Congatec.
> 
> Cc: stable@vger.kernel.org
> Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>

Acked-by: Andi Shyti <andi.shyti@kernel.org>

Thanks,
Andi

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

* Re: [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status
  2026-11-17  9:47 ` [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status Thomas Richard (congatec GmbH)
@ 2026-11-26 13:34   ` Andi Shyti
  0 siblings, 0 replies; 11+ messages in thread
From: Andi Shyti @ 2026-11-26 13:34 UTC (permalink / raw)
  To: Thomas Richard (congatec GmbH)
  Cc: Lee Jones, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable

Hi,

On Tue, Nov 17, 2026 at 10:47:42AM +0100, Thomas Richard (congatec GmbH) wrote:
> From: Lee Jones <lee@kernel.org>
> 
> In cgbc_i2c_xfer_msg(), read_poll_timeout() uses the same ret variable
> to store the polled return value of cgbc_i2c_get_status() and the
> timeout result of the macro itself.  When cgbc_i2c_get_status() returns
> a negative error code (such as -EIO on an I2C NACK), the loop condition
> ret != CGBC_I2C_STAT_BUSY evaluates to true and read_poll_timeout()
> overwrites ret with 0.  The driver then issues CGBC_I2C_CMD_DATA, which
> completes with CGBC_STATUS_CMD_READY without populating msg->buf,
> leaving uninitialised heap memory in the caller's read buffer.
> 
> Store the polled status in a separate variable, verify that it equals
> CGBC_I2C_STAT_DAT, and check that CGBC_I2C_CMD_DATA returns the expected
> number of bytes.
> 
> Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
> Closes: https://sashiko.dev/#/bug/linux-66cbf4b1-a219-4012-969d-236417bf419a
> Cc: stable@vger.kernel.org
> Reviewed-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
> Tested-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
> Signed-off-by: Lee Jones <lee@kernel.org>
> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Thanks,
Andi

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

* Re: [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names
  2026-11-17  9:47 ` [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
  2026-11-26 12:54   ` Andi Shyti
@ 2026-11-26 13:41   ` Andi Shyti
  2026-11-26 14:21     ` Thomas Richard
  1 sibling, 1 reply; 11+ messages in thread
From: Andi Shyti @ 2026-11-26 13:41 UTC (permalink / raw)
  To: Thomas Richard (congatec GmbH)
  Cc: Lee Jones, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable

Hi Thomas,

On Tue, Nov 17, 2026 at 10:47:43AM +0100, Thomas Richard (congatec GmbH) wrote:
> The adapter names described the expected purpose of the buses ("General
> Purpose I2C adapter", "Power Management I2C adapter") on conga-sa7 board
> rather than their actual names on the Board Controller.
> 
> Rename them to the real bus names "cgbc-i2c0" and "cgbc-ddc0", matching
> the naming used by Congatec.
> 
> Cc: stable@vger.kernel.org
> Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>

BTW, do we really need the Fixes tag here and the Cc stable?

Andi

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

* Re: [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names
  2026-11-26 13:41   ` Andi Shyti
@ 2026-11-26 14:21     ` Thomas Richard
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Richard @ 2026-11-26 14:21 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Lee Jones, Thomas Petazzoni, Werner Gartner, mfd, linux-kernel,
	linux-i2c, stable

On 11/26/26 2:41 PM, Andi Shyti wrote:
> Hi Thomas,
> 
> On Tue, Nov 17, 2026 at 10:47:43AM +0100, Thomas Richard (congatec GmbH) wrote:
>> The adapter names described the expected purpose of the buses ("General
>> Purpose I2C adapter", "Power Management I2C adapter") on conga-sa7 board
>> rather than their actual names on the Board Controller.
>>
>> Rename them to the real bus names "cgbc-i2c0" and "cgbc-ddc0", matching
>> the naming used by Congatec.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 6894f640b8f3 ("i2c: Congatec Board Controller i2c bus driver")
>> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
> 
> BTW, do we really need the Fixes tag here and the Cc stable?
Not really, I can remove them.

Best Regards,
Thomas

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

end of thread, other threads:[~2026-11-26 14:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17  9:47 [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
2026-11-17  9:47 ` [PATCH v6 01/10] mfd: cgbc: Fix use of negative error code as valid session handle Thomas Richard (congatec GmbH)
2026-11-17  9:47 ` [PATCH v6 02/10] i2c: cgbc: Propagate hardware errors when polling read status Thomas Richard (congatec GmbH)
2026-11-26 13:34   ` Andi Shyti
2026-11-17  9:47 ` [PATCH v6 03/10] i2c: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
2026-11-26 12:54   ` Andi Shyti
2026-11-26 13:41   ` Andi Shyti
2026-11-26 14:21     ` Thomas Richard
2026-11-19 19:03 ` [PATCH v6 00/10] Congatec Board Controller: Add storage devices support Lee Jones
2026-11-19 19:11   ` Thomas Richard
2026-11-26 10:24   ` Thomas Richard

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