From patchwork Fri Oct 27 18:23:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 159106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp805551vqb; Fri, 27 Oct 2023 11:31:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsuj77fZCDrgKDydAMnRa8riHx21xmkqeegHp/4UnzPQQT/Cnn/bDtwULbSqADUWwGptJZ X-Received: by 2002:a05:620a:6183:b0:779:d143:c18a with SMTP id or3-20020a05620a618300b00779d143c18amr2799475qkn.26.1698431511156; Fri, 27 Oct 2023 11:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698431511; cv=none; d=google.com; s=arc-20160816; b=w3iPfTMRIun/7gn3kDxXkDhSphCaPBzQsz+A17dvH8UXM9Sx9GQyOQQWdTY93QCQDR pk7mjBQSP4BJNUro/IocT/AayCr142e0+VNhez6NYkjqVBvAhfOksnebRjdWMDLaacQO pjFKLPcv/gkuu9IZJs7NNXFQBq2YkVFGAVgOoQFgUp5pOn32jICi/a7dq/T5NyIjP2bs pn37PuuB1Xj/fBSJpAO/aE/t3SOws5cY143QmNoRc1qZr0uzp9GBxF25x+WUnDwY+RBA 3ROcX3AvWISftzAd/KcWR6DL6R74bCLNvSaWOj1/UG0IPdYgC7T2WDeFiLgqb/RSMC4l iY4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Fw2xBMxpLrv+XNAvx9BRKtkO3b97IRYUnJKfUKQGM4I=; fh=QsDjRRLoDVvNl7pOGPh5ZtjWIr0zPhpKlvZb4z1HoCM=; b=ofCNfKSp2qb/ULxMs9NlGBci/fxgX9RUSuAyIdL0mAqUXVMiDyD8YVQ2jtXFDR6z/M gnORkkilcCOaybDPvsSmI86TBuikdj9PJCdfgHaeU095M8wID/S65xwzfktLKVFFxW+H E7FaeM4yydBpUjVmVLGx+ryUNkdwEWNgA27C7NFQUx96Leu3MEUpWuQy9d1Ip7wB1x+W F1BC2Z8frD9b91YOGXeZyPxUrgxuqXJgx2ft9sUDsedgwVBqe/Xf4R1yi/N0uCVEmTB4 KWm552Rhaae3aFNrFMmdcfzun5m3brgnUZ3yWbJruYskTSHpOE2xt958UoEVudsY8q9U Yvtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xdNzJ6ZB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id pe42-20020a05620a852a00b00767dc58f2f8si924975qkn.48.2023.10.27.11.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 11:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=xdNzJ6ZB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 398D4828C4BF; Fri, 27 Oct 2023 11:31:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235169AbjJ0Sbe (ORCPT + 25 others); Fri, 27 Oct 2023 14:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346394AbjJ0SbT (ORCPT ); Fri, 27 Oct 2023 14:31:19 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB60171D; Fri, 27 Oct 2023 11:23:44 -0700 (PDT) Date: Fri, 27 Oct 2023 18:23:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698430993; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fw2xBMxpLrv+XNAvx9BRKtkO3b97IRYUnJKfUKQGM4I=; b=xdNzJ6ZBE6HlbCvE/E3ixYSzWptoKVh0GgwQY16WWXW8e0Bl1AVzFDxuqphDhWMmmNxE00 R+SNB8cY3VpVcbACmwwubb9DQXYmBQAhkToC2/pFvLFlYc73KtIM8lrOFsiw3os++mBaEA Lcqucgkqt8quv1qbMjJHsEDAI1QgvKMv3MngC3pptjBghHNuT4ax0jYcBG46R3dQ5FKlJJ eLOi8RL1bnyQHAErcTZuzZZM4iSxdMCsAz4scSESBQlyTt976kVaYTkhE0Q9QltnednJ8m Eqr99ldnx+ad7RjPwHv5Fh+kMKddawOTaFROtD5ypge5UM92RrfIGPJfNj62FQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698430993; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fw2xBMxpLrv+XNAvx9BRKtkO3b97IRYUnJKfUKQGM4I=; b=V5XElj0SglB3dBVt3q47B3nfSkntVhy27fsAXCOSB6NjbP2mXIBJ1smd8LKvYKJC2I+1iU s8JVPfHe8z+IQsDQ== From: "tip-bot2 for Jacky Bai" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clocksource/drivers/timer-imx-gpt: Fix potential memory leak Cc: Jacky Bai , Peng Fan , Daniel Lezcano , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231009083922.1942971-1-ping.bai@nxp.com> References: <20231009083922.1942971-1-ping.bai@nxp.com> MIME-Version: 1.0 Message-ID: <169843099292.3135.663516180882506542.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 27 Oct 2023 11:31:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780934520176909548 X-GMAIL-MSGID: 1780934520176909548 The following commit has been merged into the timers/core branch of tip: Commit-ID: 8051a993ce222a5158bccc6ac22ace9253dd71cb Gitweb: https://git.kernel.org/tip/8051a993ce222a5158bccc6ac22ace9253dd71cb Author: Jacky Bai AuthorDate: Mon, 09 Oct 2023 16:39:22 +08:00 Committer: Daniel Lezcano CommitterDate: Wed, 11 Oct 2023 10:10:34 +02:00 clocksource/drivers/timer-imx-gpt: Fix potential memory leak Fix coverity Issue CID 250382: Resource leak (RESOURCE_LEAK). Add kfree when error return. Signed-off-by: Jacky Bai Reviewed-by: Peng Fan Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20231009083922.1942971-1-ping.bai@nxp.com --- drivers/clocksource/timer-imx-gpt.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c index 28ab4f1..6a878d2 100644 --- a/drivers/clocksource/timer-imx-gpt.c +++ b/drivers/clocksource/timer-imx-gpt.c @@ -434,12 +434,16 @@ static int __init mxc_timer_init_dt(struct device_node *np, enum imx_gpt_type t return -ENOMEM; imxtm->base = of_iomap(np, 0); - if (!imxtm->base) - return -ENXIO; + if (!imxtm->base) { + ret = -ENXIO; + goto err_kfree; + } imxtm->irq = irq_of_parse_and_map(np, 0); - if (imxtm->irq <= 0) - return -EINVAL; + if (imxtm->irq <= 0) { + ret = -EINVAL; + goto err_kfree; + } imxtm->clk_ipg = of_clk_get_by_name(np, "ipg"); @@ -452,11 +456,15 @@ static int __init mxc_timer_init_dt(struct device_node *np, enum imx_gpt_type t ret = _mxc_timer_init(imxtm); if (ret) - return ret; + goto err_kfree; initialized = 1; return 0; + +err_kfree: + kfree(imxtm); + return ret; } static int __init imx1_timer_init_dt(struct device_node *np)