Skip to content

Commit

Permalink
usb: typec: Check for ops->exit instead of ops->enter in altmode_exit
Browse files Browse the repository at this point in the history
[ Upstream commit b6ddd18 ]

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: 8a37d87 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
svenpeter42 authored and gregkh committed Dec 31, 2022
1 parent 1f56613 commit 154d571
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/typec/bus.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 154d571

Please sign in to comment.