From f33cac01f3495d2980206bcdfe07d8c955e6a40e Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Wed, 20 Jul 2016 09:51:33 -0700 Subject: [PATCH] usb: pd: Don't notify EXTCON_USB unless type is SDP or CDP commit 77f6fd80444c ("usb: pd: Add support to notify plug orientation via extcon") added an additional extcon notifier to indicate orientation. But for the PE_SNK_STARTUP case the change inadvertently notifies EXTCON_USB for all sink states when it should just be for psy_type==USB|USB_CDP. Add the missing curly braces to the if statement. Change-Id: I19d424ff0d46cc0134210424a7d431b331cbf963 Signed-off-by: Jack Pham --- drivers/usb/pd/policy_engine.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index b7b978b8d306..35d6bf1cbfee 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -669,12 +669,13 @@ static void usbpd_set_state(struct usbpd *pd, enum usbpd_state next_state) pd->current_dr = DR_UFP; if (pd->psy_type == POWER_SUPPLY_TYPE_USB || - pd->psy_type == POWER_SUPPLY_TYPE_USB_CDP) + pd->psy_type == POWER_SUPPLY_TYPE_USB_CDP) { extcon_set_cable_state_(pd->extcon, EXTCON_USB_CC, is_cable_flipped(pd)); extcon_set_cable_state_(pd->extcon, EXTCON_USB, 1); + } } pd->rx_msg_len = 0;