From patchwork Mon Jul 12 06:01:50 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: 475933 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 5E808C07E99 for ; Mon, 12 Jul 2021 06:54:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4409D61362 for ; Mon, 12 Jul 2021 06:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239228AbhGLG51 (ORCPT ); Mon, 12 Jul 2021 02:57:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:56792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240968AbhGLG4O (ORCPT ); Mon, 12 Jul 2021 02:56:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74624608FE; Mon, 12 Jul 2021 06:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072806; bh=3H0SwX8WVDWBTcYwGQUzvFicQGh1Vm57tG+Nwkc1Lt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDQ23Kvi+cRj68+EXRlWcPuPNrMupMPJBrvGoaitSyIzp4pGgrMOt9Kl4g/TtHhZE eoZlt9mek0daUQTmp7GO3+fV0OomiOypLDEIL7Gt4TQM3GdN2a2EjEvB2VMLHq54n2 D0Qm5fgLzKaTEqiag/WI1L0t65lmOeutHROwGTlw= 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.12 027/700] usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() Date: Mon, 12 Jul 2021 08:01:50 +0200 Message-Id: <20210712060928.519716837@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@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 @@ -572,8 +572,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;