Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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")
Signed-off-by: Sven Peter <sven@svenpeter.dev>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20221114165924.33487-1-sven@svenpeter.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sven Peter and committed by
Greg Kroah-Hartman
b6ddd180 7b462b05

+1 -1
+1 -1
drivers/usb/typec/bus.c
··· 134 134 if (!adev || !adev->active) 135 135 return 0; 136 136 137 - if (!pdev->ops || !pdev->ops->enter) 137 + if (!pdev->ops || !pdev->ops->exit) 138 138 return -EOPNOTSUPP; 139 139 140 140 /* Moving to USB Safe State */