Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2554589rdh; Sun, 29 Oct 2023 23:57:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpWcczMdRjyJLXfDlfOvfVpJoe5ERjqsT23vwm+4AETwWtn6ydgBKAD7v+SzFUA/mF0yRn X-Received: by 2002:a05:6a00:939a:b0:6b8:3375:4885 with SMTP id ka26-20020a056a00939a00b006b833754885mr7622513pfb.1.1698649044806; Sun, 29 Oct 2023 23:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698649044; cv=none; d=google.com; s=arc-20160816; b=XDMLevKMR5shNcsN1hImvubBlWXUKPoHVlCxAhndhJIeFTwVxvCRjLMTeI/Dd7jthf jj0Imm2eEKssK9mF3EdgNgtVvhpVqN1TkGt351KXOdh6VPwqvQ3Vjmpz/Dqh1suEe1GS YIxlhdcciUrQqbtF8oVbavbEGlP86h+SMS527gYrqyZ46JaAdfT1EaL+553mmMXXQXue O0EctIkdxOF8uOlIj7+GeNO0a8mAT/UmJVXyw75DRe3zhahohrnfbmnVFzeWaoN1GY4f ErId7j7oVilO5nLYBhgpYmuXzcA4W8W/oOeiMhPwQYsrpyEfx4K0OTPenKrh0ALW5AQk /QTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KkbJNouXf1jB9o5VmPFQMXyslZ7BV0Kwtr1ZfMOhED0=; fh=HXtoumapmAmswO4cTSuR/j3y/lAjt2tMts7TuS6YgBY=; b=MgpFq+FWkzzrUrBrvO79Iy4cqkROdEPtnqk2OWUNK81TRrnBpx83LDE48euGjaUeJg 0WYyot+EeeFIFZ7rsaKj1tPE52Es0jihTZfRS8MPVhTKTqHZ3WxC/wihjCYHZAe3q+/W sgz0jBU8mYyFesTuqCJX9d2hgeoFZV0UjEBQ8LGajmdwPhTCZI81dA1wz1KnFmBz3Cez nDH388UeNNndZ/9f+5F248owG0M8UDo6HmsqivXIq+zca+aB29QytYMRR2LWnMiJPZVN FLT4CZ8XAfLuOQPr0Mm/TDZbDVmWQT1FIqD8C6dF28uP1xqntknnmE+0TjL0xTz2qKxf TB4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EoVYKNhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bo10-20020a056a02038a00b005ac6d182454si4788212pgb.497.2023.10.29.23.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 23:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=EoVYKNhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8AD788053C73; Sun, 29 Oct 2023 23:57:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbjJ3G5H (ORCPT + 99 others); Mon, 30 Oct 2023 02:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231835AbjJ3G47 (ORCPT ); Mon, 30 Oct 2023 02:56:59 -0400 Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB9BBD4D for ; Sun, 29 Oct 2023 23:56:47 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id xMCXqf3ZpdFbKxMCYqfBpU; Mon, 30 Oct 2023 07:56:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698649004; bh=KkbJNouXf1jB9o5VmPFQMXyslZ7BV0Kwtr1ZfMOhED0=; h=From:To:Cc:Subject:Date; b=EoVYKNhntLWgaYt3lWeEflSOZ13HEfu/PRa3sOcgLqsK3MV7pxUJifqbTgmfk2O7/ vWjc7K1Z2Qbu21SmYAlk9rUHOYm6MlHCVJqFw2G2qJgljuXyc/CRI+92VrdCXZMPrZ AlYLANf8MBiak0D//G9tr+2KOybPtRV2adO1fED9zi91KE9VoSKzeC1xY2I3szqAMw zbdBSRWA2TkEOCnTLeTZxt6bUvI6AGzHTeiErlLWZpoDYhc83ym9e859FZQFnQ6rey hwbvzwcgRfI5Zf2LSKh96lQUMWAsMjF7ZLWt/OZl4BWM/Cd6WfZuzttBDWgfGm6Eek WvVUEnoMFaTiw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 30 Oct 2023 07:56:44 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Heikki Krogerus , Greg Kroah-Hartman , Abdel Alkuor Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-usb@vger.kernel.org Subject: [PATCH] USB: typec: tps6598x: Fix a memory leak in an error handling path Date: Mon, 30 Oct 2023 07:56:40 +0100 Message-Id: <23168336f18a9f6cb1a5b47130fc134dc0510d7f.1698648980.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 29 Oct 2023 23:57:22 -0700 (PDT) All error handling end to the error handling path, except these ones. Go to 'release_fw' as well here, otherwise 'fw' is leaking. Fixes: 7e7a3c815d22 ("USB: typec: tps6598x: Add TPS25750 support") Signed-off-by: Christophe JAILLET --- drivers/usb/typec/tipd/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 0e867f531d34..b0184be06c3d 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -968,16 +968,17 @@ static int tps25750_start_patch_burst_mode(struct tps6598x *tps) ret = of_property_match_string(np, "reg-names", "patch-address"); if (ret < 0) { dev_err(tps->dev, "failed to get patch-address %d\n", ret); - return ret; + goto release_fw; } ret = of_property_read_u32_index(np, "reg", ret, &addr); if (ret) - return ret; + goto release_fw; if (addr == 0 || (addr >= 0x20 && addr <= 0x23)) { dev_err(tps->dev, "wrong patch address %u\n", addr); - return -EINVAL; + ret = -EINVAL; + goto release_fw; } bpms_data.addr = (u8)addr; -- 2.34.1