]> git.ipfire.org Git - thirdparty/linux.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>
Tue, 4 Jun 2024 13:36:12 +0000 (15:36 +0200)
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>
drivers/usb/typec/ucsi/ucsi.c

index cb52e7b0a2c5cd6702ee8c4e182652984721e5e0..2cc7aedd490f16b1bdb3860930b880452c9654a5 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);
        }