From c2ee1fcf3689b8d503770a03ff570dd7bc853fd6 Mon Sep 17 00:00:00 2001 From: Pratham Pratap Date: Thu, 6 Aug 2020 12:28:15 +0530 Subject: [PATCH] usb: pd: Clear send_get_status flag in protocol reset Consider a scenario where a connected PD partner has sent an alert message to the device and driver marked send_get_status to true and queued usbpd_sm work with a delay of 150ms. Now, if the cable gets disconnected before the start of usbpd_sm work then send_get_status flag will not get cleared anywhere. On the next cable plug-in, in PE_SNK_READY driver will unnecessarily send Get_Status again which is incorrect and may lead to soft/hard reset causing the PD partner to disconnect. Fix this by clearing the send_get_status flag in the protocol reset. Change-Id: I4747b0a25a0870e83ff78e0b9ccd7e3fd91ed9e6 Signed-off-by: Pratham Pratap --- drivers/usb/pd/policy_engine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index 9bdc9070fef0..b3d799dfab5b 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -743,6 +743,7 @@ static inline void pd_reset_protocol(struct usbpd *pd) memset(pd->rx_msgid, -1, sizeof(pd->rx_msgid)); memset(pd->tx_msgid, 0, sizeof(pd->tx_msgid)); pd->send_request = false; + pd->send_get_status = false; pd->send_pr_swap = false; pd->send_dr_swap = false; }