From patchwork Fri Jan 6 05:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 39938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp656793wrt; Thu, 5 Jan 2023 21:42:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdZtu4Fz9A4cOzeH2+/mEki+yghXpRGEyd08QEGa/t1DyATx1aScgWKsERbp9ynHFv/QJP X-Received: by 2002:a17:906:cd1a:b0:801:d0bc:f616 with SMTP id oz26-20020a170906cd1a00b00801d0bcf616mr61627628ejb.62.1672983727770; Thu, 05 Jan 2023 21:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672983727; cv=none; d=google.com; s=arc-20160816; b=A4UHXvAROLVdaiaDG00EqOOfmbMZYVZSHj9aEowWhEdPC/R/LKxA6gfDNHUwDTDG/W uoq6OSmZoCYBuJ3jTn4yT3Am75kESORun22SXXAhP/rlBXYuQvgcl6kSMiDyG6xF69Zf yWRod/MKZ73mQ+xtxtqw1Sy5qjMfPI/RtWxzpWLa64GsIeSyfwj52Zhos59lx0uOI4wu ZRfHg9sX2e2rWbn3ZtaeNyvy4/PvOrAMcOG/EWg57y7HO56lkQlAKNvu/sci54hk5Ms+ iESBMwUJsynoIaZdjZUQJ5ETb6JSfA3fC3FA7WP9V19uqiYZw3hTLkXAh/RVO9DPVBCf Y7Ow== 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=cAq/ViZLPRG+IbYXxjYoUcfudX/jAXQF/9Rus0IPRi8=; b=EClVNTFm9hro43wwIrOw9F1JEgJCatNsJuaYqXv5AcJ3q3qfxS/KBHezWMZuJYUJYo 4TbTTgKj84etfhXKCzTnrEl7aMrb+U7D7nPdH2JkaIRekxOel2zmVR4VBIMNWVd9SIWY Me7EmHXEpRA2SDfkQTrXA8XyDf8lM2vCslFhnl41RTmydEPbkrzv30kWtoCZ02DFuPY2 8npUDIpnxm1chx3c9FnvtYsFFPhKQnB2poJl8zk2riL05Gkmppd06/cVBVjN+R0agE2v hmpaMzsic4pd89MzWrl/uXrmpvn8CMFkkabtRKxtX3OGbj0Sp3jNw7x3hwqxkBHh+vz2 lQDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lq8FEDrl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906595900b0084c46478993si185908ejr.775.2023.01.05.21.41.43; Thu, 05 Jan 2023 21:42:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lq8FEDrl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbjAFFkh (ORCPT + 99 others); Fri, 6 Jan 2023 00:40:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjAFFkg (ORCPT ); Fri, 6 Jan 2023 00:40:36 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C425AC71 for ; Thu, 5 Jan 2023 21:40:31 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id h192so541373pgc.7 for ; Thu, 05 Jan 2023 21:40:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cAq/ViZLPRG+IbYXxjYoUcfudX/jAXQF/9Rus0IPRi8=; b=Lq8FEDrl7w73AawfkdR0gzucxPyYA88LoMQ9IKo5nwc1q0IFPeO+RrV7QfVr2J7PcU nKPGFig5ECCU1f7rLNN+fcLqS234b87jLmkLs7nMYwBVPm7z/AJzuKs/npew4GxdNkJH qoMHeDNLB5WX0XsejLBe1jTC7YLeVuodNQS4yqBNeTR5NN9htWbH5vpfu43FpPsCunum UhCQIfy+LGU7ZDkh5ZGTYMMKMi3xfVLrpc/AVEaKjSfaUvx7lpXxYScw7cgo30H5b5ty 4u484EW1raeq8/iY0uaB68T1JTP8a7Jl3IEcxQJVbA8kL5+fPDJ4ixlG0Af8xKEYhLXL qJlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cAq/ViZLPRG+IbYXxjYoUcfudX/jAXQF/9Rus0IPRi8=; b=8KWck/MMPEBjGs7qG+ZNcULgb9JuF9aioqJQ26Qdaob3TmKW18ZmTWm1xMP3FE5P1M ZDisU5aWx3zWjUoKUeKZGaJw2l9K6BbyIamNxGkAwjZh02579ALyOYo4lP+dwzAlO2G7 AjzvCUvF5BHgYHD6BiPC/oYQdFkPhqwOEoTv/vMSzymfXWrOHa75gc1U1d7+Eb34zOYw vzZWNp00uUQRjhk9eddVTpDuJfMSoDRmyVItGmLwI9xxFf8zG1kzexIKCo1gpnjaFr+q UGFmbUougYYRSl0cWe0IP6mmIN7d/sZyK0/lin9uGK4hoLMIVCccuCGMGgif6sXzr3Za 5WmA== X-Gm-Message-State: AFqh2kqgtzT6QBcojyG42xdxf3KksZTOHppImizfrRKfa8qFi5o7OdPR iBWfrrTWouNPf/aUFInGWoM= X-Received: by 2002:aa7:99cb:0:b0:580:d188:f516 with SMTP id v11-20020aa799cb000000b00580d188f516mr52824129pfi.19.1672983631353; Thu, 05 Jan 2023 21:40:31 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id y11-20020aa79e0b000000b0057ef155103asm209763pfq.155.2023.01.05.21.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 21:40:30 -0800 (PST) From: Miaoqian Lin To: Nishanth Menon , Santosh Shilimkar , Keerthy , Dave Gerlach , Tony Lindgren , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linmq006@gmail.com Subject: [PATCH] soc: ti: pm33xx: Fix refcount leak in am33xx_pm_probe Date: Fri, 6 Jan 2023 09:40:22 +0400 Message-Id: <20230106054022.947529-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754250585176571880?= X-GMAIL-MSGID: =?utf-8?q?1754250585176571880?= wkup_m3_ipc_get() takes refcount, which should be freed by wkup_m3_ipc_put(). Add missing refcount release in the error paths. Fixes: 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add rtc_only with ddr in self-refresh support") Signed-off-by: Miaoqian Lin --- drivers/soc/ti/pm33xx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/soc/ti/pm33xx.c b/drivers/soc/ti/pm33xx.c index ce09c42eaed2..f04c21157904 100644 --- a/drivers/soc/ti/pm33xx.c +++ b/drivers/soc/ti/pm33xx.c @@ -527,7 +527,7 @@ static int am33xx_pm_probe(struct platform_device *pdev) ret = am33xx_pm_alloc_sram(); if (ret) - return ret; + goto err_wkup_m3_ipc_put; ret = am33xx_pm_rtc_setup(); if (ret) @@ -572,13 +572,14 @@ static int am33xx_pm_probe(struct platform_device *pdev) pm_runtime_put_sync(dev); err_pm_runtime_disable: pm_runtime_disable(dev); - wkup_m3_ipc_put(m3_ipc); err_unsetup_rtc: iounmap(rtc_base_virt); clk_put(rtc_fck); err_free_sram: am33xx_pm_free_sram(); pm33xx_dev = NULL; +err_wkup_m3_ipc_put: + wkup_m3_ipc_put(m3_ipc); return ret; }