public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: Check for ops->exit instead of ops->enter in altmode_exit
@ 2022-11-14 16:59 Sven Peter
  2022-11-16 12:05 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Peter @ 2022-11-14 16:59 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman; +Cc: Sven Peter, linux-usb, linux-kernel

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>
---
 drivers/usb/typec/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
index 26ea2fdec17d..31c2a3130cad 100644
--- a/drivers/usb/typec/bus.c
+++ b/drivers/usb/typec/bus.c
@@ -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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: typec: Check for ops->exit instead of ops->enter in altmode_exit
  2022-11-14 16:59 [PATCH] usb: typec: Check for ops->exit instead of ops->enter in altmode_exit Sven Peter
@ 2022-11-16 12:05 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2022-11-16 12:05 UTC (permalink / raw)
  To: Sven Peter; +Cc: Greg Kroah-Hartman, linux-usb, linux-kernel

On Mon, Nov 14, 2022 at 05:59:24PM +0100, Sven Peter wrote:
> 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>

No Cc: stable@...?

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
> index 26ea2fdec17d..31c2a3130cad 100644
> --- a/drivers/usb/typec/bus.c
> +++ b/drivers/usb/typec/bus.c
> @@ -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,

-- 
heikki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-16 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 16:59 [PATCH] usb: typec: Check for ops->exit instead of ops->enter in altmode_exit Sven Peter
2022-11-16 12:05 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox