Skip to content

Commit d69030c

Browse files
amaramadgregkh
authored andcommitted
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: b7404a2 ("usb: typec: intel_pmc_mux: Definitions for response status bits") Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200916091102.27118-4-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bcea6da commit d69030c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/usb/typec/mux/intel_pmc_mux.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,19 @@ static int hsl_orientation(struct pmc_usb_port *port)
125125
static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
126126
{
127127
u8 response[4];
128+
int ret;
128129

129130
/*
130131
* Error bit will always be 0 with the USBC command.
131-
* Status can be checked from the response message.
132+
* Status can be checked from the response message if the
133+
* function intel_scu_ipc_dev_command succeeds.
132134
*/
133-
intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,
134-
response, sizeof(response));
135+
ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
136+
len, response, sizeof(response));
137+
138+
if (ret)
139+
return ret;
140+
135141
if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
136142
if (response[2] & PMC_USB_RESP_STATUS_FATAL)
137143
return -EIO;

0 commit comments

Comments
 (0)