From patchwork Mon Jul 12 06:06:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 476408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0C43C07E9B for ; Mon, 12 Jul 2021 06:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA2FC610A7 for ; Mon, 12 Jul 2021 06:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233265AbhGLGRm (ORCPT ); Mon, 12 Jul 2021 02:17:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:35760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbhGLGRl (ORCPT ); Mon, 12 Jul 2021 02:17:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98B93610A6; Mon, 12 Jul 2021 06:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626070494; bh=Hb1lEzf+JK34OsTWk/E+Fq91hgNgiteVXknCqDl+mfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9Aa3KFORgf0bZ0fZ3AGO0ydFBJGaXZOpwLBIjaagQ2arnRtGoe7hA+UyH565U8h+ g5oBCEiohCk2+aeG+KYHU4fac7FRgGMPwaQI+1ddvxKrxa8ITJHH/svlWwLmGqFyYm scwg3mwRN+fgLjBghRcixFG29Ep8tgyRnHL0Vvr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Jing Xiangfeng Subject: [PATCH 5.4 015/348] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() Date: Mon, 12 Jul 2021 08:06:39 +0200 Message-Id: <20210712060702.206833493@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jing Xiangfeng commit 03026197bb657d784220b040c6173267a0375741 upstream. 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") Cc: stable Acked-by: Heikki Krogerus Signed-off-by: Jing Xiangfeng Link: https://lore.kernel.org/r/20210617073226.47599-1-jingxiangfeng@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/class.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -487,8 +487,10 @@ typec_register_altmode(struct device *pa 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;