From patchwork Thu Jun 8 19:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 105104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp494510vqr; Thu, 8 Jun 2023 12:25:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xRIlsoVTDqPhhiTPUu6bsA0N5skXczA4iPZL6eYJu9wGraEOdNZkEhTrQuOqXKU7pUZC3 X-Received: by 2002:a17:903:1c9:b0:1af:b7cd:5961 with SMTP id e9-20020a17090301c900b001afb7cd5961mr6818038plh.1.1686252337403; Thu, 08 Jun 2023 12:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686252337; cv=none; d=google.com; s=arc-20160816; b=C2UFLsIXaSzrQXVO8mX5QKScc90NYv/Gtnx2H8UgOg2aH7pmHSaspjk5W+sIe0p+ET 1g4UHAtzru0smU5eWAmAwNegfpDMn1nriaormVBIHT4QG+rkRKpoS/KGMM5nhl0m0UT0 MHOrGQn3CdIfyh0daF0zccNiIkM4QQPmwl2EmWb/FTwwHfLVL4uebgNG3IwEzk3bVcTQ ihkGa+QIOYvfLkB3wdCvMJn+xhmxFkCU6gHkR4BuAOFg0pqnvEyBJGcSAETq8CtiMMLZ bZ4f5MCZQTilU+Ztet2+x6coPf73u935zvdQqy3waEijJmtkyNMj0q4LpX+OF5VMLI73 BTvQ== 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=rMbp0A0nCVWbFNITEeTCYWZN0nSZsQCHQh6V232GAHE=; b=JDOLka/E7mbBtyVeSFqhX6splpmKruHveqIodfyk3WeRKf/q6tahqZ0bb5XJBSNBwI JjxKdSjD8HCT+NwdUQmfuaj+762M7zxLcK0n2ZhXWIZqcjNzKvibm84FVdxgL1FDZpTN d71xYvw50Jl53PQqjBMpjEfqBev+s81O83hbouceNdWNNjGHu0tXM6zxwLIa5KFvRkFs rK769Dr5j04zjikqPU+EPAAfY0UfBA2qtsnqSQFb2lBYUOTg1TVT4DuraVwJaol+P5kD ELOKTO/+/J6ElzFFXsMR9r84+pF2XK+el+2X5EeJkwEyg5VIYzOdmlwjGVLH7yfymSTb ZbaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=rx4ykTJ6; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a17090a1d4f00b00247526ba960si3149953pju.119.2023.06.08.12.25.24; Thu, 08 Jun 2023 12:25:37 -0700 (PDT) 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=@wanadoo.fr header.s=t20230301 header.b=rx4ykTJ6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233824AbjFHTLx (ORCPT + 99 others); Thu, 8 Jun 2023 15:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233160AbjFHTLv (ORCPT ); Thu, 8 Jun 2023 15:11:51 -0400 Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 804A62D4B for ; Thu, 8 Jun 2023 12:11:49 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 7L2uq3N8w8gUX7L2uqbsxa; Thu, 08 Jun 2023 21:11:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686251507; bh=rMbp0A0nCVWbFNITEeTCYWZN0nSZsQCHQh6V232GAHE=; h=From:To:Cc:Subject:Date; b=rx4ykTJ6CnQ8aiS9/VY7PU0mBKR/mRJ1mhqdYbBlA9YI8mM9rK3+ZCenaCyWoaNsE Z3UMLlZoSRo2dFVZWfzKuU0WrhfX+k8XikdQ+VQnlPqI/hus9WzTrxcwdjRzjwI2iN ha5olxDqPTDlqHdnECJGd/XuLWuk/WWc1KRmym4b7XQakdGrKqXRzHH4jdG8MMQbd/ 1X3/i+2Xt6nHhi5REkkYWaJKtW1+YZ2wwvXXHO3sQ+E5dIRkpeFSbIRDuULSbo03uN nucZmyyyGzqTOik/a0M38rXnk56MIbc9bjWczMwLo7T4QxHFWLszksPtesOJa2igmp Am5Yeq9L6AIQg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 08 Jun 2023 21:11:47 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Patrice Chotard , Alessandro Zummo , Alexandre Belloni , Lee Jones Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org Subject: [PATCH 1/2] rtc: st-lpc: Release some resources in st_rtc_probe() in case of error Date: Thu, 8 Jun 2023 21:11:42 +0200 Message-Id: <866af6adbc7454a7b4505eb6c28fbdc86ccff39e.1686251455.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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?1768163730706518066?= X-GMAIL-MSGID: =?utf-8?q?1768163730706518066?= If an error occurs after clk_get(), the corresponding resources should be released. Use devm_clk_get() to fix it. Fixes: b5b2bdfc2893 ("rtc: st: Add new driver for ST's LPC RTC") Signed-off-by: Christophe JAILLET --- drivers/rtc/rtc-st-lpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c index 0f8e4231098e..d04d46f9cc65 100644 --- a/drivers/rtc/rtc-st-lpc.c +++ b/drivers/rtc/rtc-st-lpc.c @@ -228,7 +228,7 @@ static int st_rtc_probe(struct platform_device *pdev) enable_irq_wake(rtc->irq); disable_irq(rtc->irq); - rtc->clk = clk_get(&pdev->dev, NULL); + rtc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(rtc->clk)) { dev_err(&pdev->dev, "Unable to request clock\n"); return PTR_ERR(rtc->clk);