All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
@ 2021-06-17  7:32 Jing Xiangfeng
  2021-06-17 10:18 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Xiangfeng @ 2021-06-17  7:32 UTC (permalink / raw)
  To: heikki.krogerus, gregkh; +Cc: linux-usb, linux-kernel, jingxiangfeng

typec_register_altmode() misses to call altmode_id_remove() in an error
path. Add the missed function call to fix it.

Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
 drivers/usb/typec/class.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index b9429c9f65f6..aeef453aa658 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -517,8 +517,10 @@ typec_register_altmode(struct device *parent,
 	int ret;
 
 	alt = kzalloc(sizeof(*alt), GFP_KERNEL);
-	if (!alt)
+	if (!alt) {
+		altmode_id_remove(parent, id);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	alt->adev.svid = desc->svid;
 	alt->adev.mode = desc->mode;
-- 
2.26.0.106.g9fadedd


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

* Re: [PATCH] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
  2021-06-17  7:32 [PATCH] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() Jing Xiangfeng
@ 2021-06-17 10:18 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2021-06-17 10:18 UTC (permalink / raw)
  To: Jing Xiangfeng; +Cc: gregkh, linux-usb, linux-kernel

On Thu, Jun 17, 2021 at 03:32:26PM +0800, Jing Xiangfeng wrote:
> typec_register_altmode() misses to call altmode_id_remove() in an error
> path. Add the missed function call to fix it.
> 
> Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>

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

> ---
>  drivers/usb/typec/class.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index b9429c9f65f6..aeef453aa658 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -517,8 +517,10 @@ typec_register_altmode(struct device *parent,
>  	int ret;
>  
>  	alt = kzalloc(sizeof(*alt), GFP_KERNEL);
> -	if (!alt)
> +	if (!alt) {
> +		altmode_id_remove(parent, id);
>  		return ERR_PTR(-ENOMEM);
> +	}
>  
>  	alt->adev.svid = desc->svid;
>  	alt->adev.mode = desc->mode;
> -- 
> 2.26.0.106.g9fadedd

-- 
heikki

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

end of thread, other threads:[~2021-06-17 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  7:32 [PATCH] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() Jing Xiangfeng
2021-06-17 10:18 ` Heikki Krogerus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.