]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: typec: ucsi: Ack also failed Get Error commands
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Fri, 31 May 2024 10:46:52 +0000 (13:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jul 2024 07:37:47 +0000 (09:37 +0200)
[ Upstream commit 8bdf8a42bca4f47646fd105a387ab6926948c7f1 ]

It is possible that also the GET_ERROR command fails. If
that happens, the command completion still needs to be
acknowledged. Otherwise the interface will be stuck until
it's reset.

Reported-by: Ammy Yi <ammy.yi@intel.com>
Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API")
Cc: stable@vger.kernel.org
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240531104653.1303519-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/typec/ucsi/ucsi.c

index 144e47ed6fae34232a283c2a644f682a544d2994..911d774c9805adba5597e7fc1b15d48f1e0a3166 100644 (file)
@@ -153,8 +153,13 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)
        }
 
        if (cci & UCSI_CCI_ERROR) {
-               if (cmd == UCSI_GET_ERROR_STATUS)
+               if (cmd == UCSI_GET_ERROR_STATUS) {
+                       ret = ucsi_acknowledge(ucsi, false);
+                       if (ret)
+                               return ret;
+
                        return -EIO;
+               }
                return ucsi_read_error(ucsi);
        }