Skip to contentSkip to conversation

slimbus: return port disconnect errors from stream unprepare

PATCH New Avi Weiss 1 participant 1 message Oct 29

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH v2 1/1 slimbus: return port disconnect errors from stream unprepare

slim_stream_unprepare() ignores errors from slim_disconnect_port() and returns success even when a port disconnect transaction fails.

Continue attempting to disconnect all ports, but return the first error to the caller. Keep freeing the port array after the attempts so a failed disconnect does not prevent a subsequent stream prepare.

Fixes abb9c9b8b51b ("slimbus: stream: add stream support")

---
Changes in v2:
- limit the fix to reporting the first disconnect error (still attempt every port and always release the port array)
- dropped v1's retained port state, selective retry, and stream_free() change to avoid blocking re-prepare in existing codec callers

A complete recovery solution would also require the codec callers to handle disconnect failures and coordinate hardware state, retries, and stream lifetime across stop/start cycles. That broader work is left for future submissions - this revision fixes error reporting without changing stream cleanup semantics.

v1: https://lore.kernel.org/r/[email protected]

 drivers/slimbus/stream.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/slimbus/stream.c +7 -4
index b4e70a7edd1cc..220e22088f8f6 100644
@@ -448,19 +448,22 @@ EXPORT_SYMBOL_GPL(slim_stream_disable);
  */
 int slim_stream_unprepare(struct slim_stream_runtime *stream)
 {
-	int i;
+	int ret = 0, err, i;
 
 	if (!stream->ports || !stream->num_ports)
 		return -EINVAL;
 
-	for (i = 0; i < stream->num_ports; i++)
-		slim_disconnect_port(stream, &stream->ports[i]);
+	for (i = 0; i < stream->num_ports; i++) {
+		err = slim_disconnect_port(stream, &stream->ports[i]);
+		if (err && !ret)
+			ret = err;
+	}
 
 	kfree(stream->ports);
 	stream->ports = NULL;
 	stream->num_ports = 0;
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(slim_stream_unprepare);
 

base-commit: 65ba8f34ec886ec72b2c07ddc8cf3d815c32869d

Signature · 1 line
2.43.0