* [PATCH] usb: typec: tcpm: fix state transition for SNK_WAIT_CAPABILITIES state in run_state_machine()
@ 2025-03-11 2:19 Amit Sunil Dhamne via B4 Relay
2025-03-12 11:38 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Amit Sunil Dhamne via B4 Relay @ 2025-03-11 2:19 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan, RD Babiera,
Kyle Tso, Sebastian Reichel, Xu Yang, stable, Amit Sunil Dhamne
From: Amit Sunil Dhamne <amitsd@google.com>
A subtle error got introduced while manually fixing merge conflict in
tcpm.c for commit 85c4efbe6088 ("Merge v6.12-rc6 into usb-next"). As a
result of this error, the next state is unconditionally set to
SNK_WAIT_CAPABILITIES_TIMEOUT while handling SNK_WAIT_CAPABILITIES state
in run_state_machine(...).
Fix this by setting new state of TCPM state machine to `upcoming_state`
(that is set to different values based on conditions).
Cc: stable@vger.kernel.org
Fixes: 85c4efbe60888 ("Merge v6.12-rc6 into usb-next")
Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 47be450d2be352698e9dee2e283664cd4db8081b..758933d4ac9e4e55d45940b068f3c416e7e51ee8 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5117,16 +5117,16 @@ static void run_state_machine(struct tcpm_port *port)
*/
if (port->vbus_never_low) {
port->vbus_never_low = false;
- tcpm_set_state(port, SNK_SOFT_RESET,
- port->timings.sink_wait_cap_time);
+ upcoming_state = SNK_SOFT_RESET;
} else {
if (!port->self_powered)
upcoming_state = SNK_WAIT_CAPABILITIES_TIMEOUT;
else
upcoming_state = hard_reset_state(port);
- tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT,
- port->timings.sink_wait_cap_time);
}
+
+ tcpm_set_state(port, upcoming_state,
+ port->timings.sink_wait_cap_time);
break;
case SNK_WAIT_CAPABILITIES_TIMEOUT:
/*
---
base-commit: 5c8c229261f14159b54b9a32f12e5fa89d88b905
change-id: 20250310-fix-snk-wait-timeout-v6-14-rc6-7b4d9fb9bc99
Best regards,
--
Amit Sunil Dhamne <amitsd@google.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: tcpm: fix state transition for SNK_WAIT_CAPABILITIES state in run_state_machine()
2025-03-11 2:19 [PATCH] usb: typec: tcpm: fix state transition for SNK_WAIT_CAPABILITIES state in run_state_machine() Amit Sunil Dhamne via B4 Relay
@ 2025-03-12 11:38 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2025-03-12 11:38 UTC (permalink / raw)
To: amitsd
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel,
Badhri Jagan Sridharan, RD Babiera, Kyle Tso, Sebastian Reichel,
Xu Yang, stable
On Mon, Mar 10, 2025 at 07:19:07PM -0700, Amit Sunil Dhamne via B4 Relay wrote:
> From: Amit Sunil Dhamne <amitsd@google.com>
>
> A subtle error got introduced while manually fixing merge conflict in
> tcpm.c for commit 85c4efbe6088 ("Merge v6.12-rc6 into usb-next"). As a
> result of this error, the next state is unconditionally set to
> SNK_WAIT_CAPABILITIES_TIMEOUT while handling SNK_WAIT_CAPABILITIES state
> in run_state_machine(...).
>
> Fix this by setting new state of TCPM state machine to `upcoming_state`
> (that is set to different values based on conditions).
>
> Cc: stable@vger.kernel.org
> Fixes: 85c4efbe60888 ("Merge v6.12-rc6 into usb-next")
> Signed-off-by: Amit Sunil Dhamne <amitsd@google.com>
> Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 47be450d2be352698e9dee2e283664cd4db8081b..758933d4ac9e4e55d45940b068f3c416e7e51ee8 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5117,16 +5117,16 @@ static void run_state_machine(struct tcpm_port *port)
> */
> if (port->vbus_never_low) {
> port->vbus_never_low = false;
> - tcpm_set_state(port, SNK_SOFT_RESET,
> - port->timings.sink_wait_cap_time);
> + upcoming_state = SNK_SOFT_RESET;
> } else {
> if (!port->self_powered)
> upcoming_state = SNK_WAIT_CAPABILITIES_TIMEOUT;
> else
> upcoming_state = hard_reset_state(port);
> - tcpm_set_state(port, SNK_WAIT_CAPABILITIES_TIMEOUT,
> - port->timings.sink_wait_cap_time);
> }
> +
> + tcpm_set_state(port, upcoming_state,
> + port->timings.sink_wait_cap_time);
> break;
> case SNK_WAIT_CAPABILITIES_TIMEOUT:
> /*
>
> ---
> base-commit: 5c8c229261f14159b54b9a32f12e5fa89d88b905
> change-id: 20250310-fix-snk-wait-timeout-v6-14-rc6-7b4d9fb9bc99
>
> Best regards,
> --
> Amit Sunil Dhamne <amitsd@google.com>
>
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-12 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11 2:19 [PATCH] usb: typec: tcpm: fix state transition for SNK_WAIT_CAPABILITIES state in run_state_machine() Amit Sunil Dhamne via B4 Relay
2025-03-12 11:38 ` Heikki Krogerus
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®