Message ID | 1737011671-88288-1-git-send-email-fengchunguo@126.com |
---|---|
State | New |
Headers | show |
Series | [1/1] usb: typec: Added power_operation_mode_show type check when usb slowly detect | expand |
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 4b3047e..22d99ce 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -2163,7 +2163,8 @@ void typec_set_pwr_opmode(struct typec_port *port, { struct device *partner_dev; - if (port->pwr_opmode == opmode) + if ((port->pwr_opmode == opmode) || (opmode < TYPEC_PWR_MODE_USB) + || (opmode > TYPEC_PWR_MODE_MAX)) return; port->pwr_opmode = opmode; diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index d616b88..3b12c46 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -71,6 +71,7 @@ enum typec_pwr_opmode { TYPEC_PWR_MODE_1_5A, TYPEC_PWR_MODE_3_0A, TYPEC_PWR_MODE_PD, + TYPEC_PWR_MODE_MAX, }; enum typec_accessory {