diff mbox series

[3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

Message ID 20200916091102.27118-4-heikki.krogerus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series USB Type-C fixes for usb-next | expand

Commit Message

Heikki Krogerus Sept. 16, 2020, 9:11 a.m. UTC
From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>

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

Fixes: b7404a29cd3d ("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>
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Greg Kroah-Hartman Sept. 16, 2020, 9:42 a.m. UTC | #1
On Wed, Sep 16, 2020 at 12:11:02PM +0300, Heikki Krogerus wrote:
> From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>
> 
> Check and return if there are errors. The response bits are valid
> only on no errors.
> 
> Fixes: b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")

This is in 5.9-rc4, so shouldn't it go in for 5.9-final?

thanks,

greg k-h
Greg Kroah-Hartman Sept. 16, 2020, 11:09 a.m. UTC | #2
On Wed, Sep 16, 2020 at 01:58:45PM +0300, Heikki Krogerus wrote:
> On Wed, Sep 16, 2020 at 11:42:48AM +0200, Greg Kroah-Hartman wrote:
> > On Wed, Sep 16, 2020 at 12:11:02PM +0300, Heikki Krogerus wrote:
> > > From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>
> > > 
> > > Check and return if there are errors. The response bits are valid
> > > only on no errors.
> > > 
> > > Fixes: b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")
> > 
> > This is in 5.9-rc4, so shouldn't it go in for 5.9-final?
> 
> You are correct. I'm sorry about that. Do you want me to resend?

No worries, I'll take it in the correct branch now, thanks!

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 109c1a796e844..d7f63b74c6b14 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -176,13 +176,19 @@  static int hsl_orientation(struct pmc_usb_port *port)
 static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
 {
 	u8 response[4];
+	int ret;
 
 	/*
 	 * 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,
-				  response, sizeof(response));
+	ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
+					len, response, sizeof(response));
+
+	if (ret)
+		return ret;
+
 	if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
 		if (response[2] & PMC_USB_RESP_STATUS_FATAL)
 			return -EIO;