Skip to contentSkip to conversation

usb: typec: Check for ops->exit instead of ops->enter in altmode_exit

PATCH In review Sven Peter 2 participants 2 messages Nov 14, 2022 – Nov 16, 2022

Subsystems (2)
lore
Share & tools
lore

Sven Peter

author
#0 lore raw

PATCH 1/1 usb: typec: Check for ops->exit instead of ops->enter in altmode_exit

typec_altmode_exit checks if ops->enter is not NULL but then calls ops->exit a few lines below. Fix that and check for the function pointer it's about to call instead.

Fixes 8a37d87d72f0 ("usb: typec: Bus type for alternate modes")
---
 drivers/usb/typec/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/bus.c +1 -1
index 26ea2fdec17d..31c2a3130cad 100644
@@ -134,7 +134,7 @@ int typec_altmode_exit(struct typec_altmode *adev)
 	if (!adev || !adev->active)
 		return 0;
 
-	if (!pdev->ops || !pdev->ops->enter)
+	if (!pdev->ops || !pdev->ops->exit)
 		return -EOPNOTSUPP;
 
 	/* Moving to USB Safe State */
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sven Peter

typec_altmode_exit checks if ops->enter is not NULL but then calls ops->exit a few lines below. Fix that and check for the function pointer it's about to call instead.

Fixes 8a37d87d72f0 ("usb: typec: Bus type for alternate modes")

No Cc: stable@...?

Quoted 9 lines
---
 drivers/usb/typec/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/bus.c +0 -0
index 26ea2fdec17d..31c2a3130cad 100644

drivers/usb/typec/bus.c int typec_altmode_exit(struct typec_altmode *adev) · line 140

Quoted 8 lines
drivers/usb/typec/bus.c +1 -1
@@ -134,7 +134,7 @@ int typec_altmode_exit(struct typec_altmode *adev)
 	if (!adev || !adev->active)
 		return 0;
 
-	if (!pdev->ops || !pdev->ops->enter)
+	if (!pdev->ops || !pdev->ops->exit)
 		return -EOPNOTSUPP;
 
 	/* Moving to USB Safe State */

thanks,

Signature · 1 line
heikki