linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Jing Xiangfeng <jingxiangfeng@huawei.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
Date: Thu, 17 Jun 2021 13:18:07 +0300	[thread overview]
Message-ID: <YMshX75xfDczNmS1@kuha.fi.intel.com> (raw)
In-Reply-To: <20210617073226.47599-1-jingxiangfeng@huawei.com>

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

      reply	other threads:[~2021-06-17 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMshX75xfDczNmS1@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jingxiangfeng@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).