Commit d69030c9 authored by Madhusudanarao Amara's avatar Madhusudanarao Amara Committed by Greg Kroah-Hartman

usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

Check and return if there are errors. The response bits are valid
only on no errors.

Fixes: b7404a29 ("usb: typec: intel_pmc_mux: Definitions for response status bits")
Signed-off-by: default avatarMadhusudanarao Amara <madhusudanarao.amara@intel.com>
Signed-off-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20200916091102.27118-4-heikki.krogerus@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bcea6daf
...@@ -125,13 +125,19 @@ static int hsl_orientation(struct pmc_usb_port *port) ...@@ -125,13 +125,19 @@ static int hsl_orientation(struct pmc_usb_port *port)
static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len) static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
{ {
u8 response[4]; u8 response[4];
int ret;
/* /*
* Error bit will always be 0 with the USBC command. * Error bit will always be 0 with the USBC command.
* Status can be checked from the response message. * Status can be checked from the response message if the
* function intel_scu_ipc_dev_command succeeds.
*/ */
intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len, ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
response, sizeof(response)); len, response, sizeof(response));
if (ret)
return ret;
if (response[2] & PMC_USB_RESP_STATUS_FAILURE) { if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
if (response[2] & PMC_USB_RESP_STATUS_FATAL) if (response[2] & PMC_USB_RESP_STATUS_FATAL)
return -EIO; return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment