Commit b6ddd180 authored by Sven Peter's avatar Sven Peter Committed by Greg Kroah-Hartman

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: 8a37d87d ("usb: typec: Bus type for alternate modes")
Signed-off-by: default avatarSven Peter <sven@svenpeter.dev>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20221114165924.33487-1-sven@svenpeter.devSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b462b05
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment