Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp270869rwe; Fri, 14 Apr 2023 02:30:04 -0700 (PDT) X-Google-Smtp-Source: AKy350bx0HLsDDsMw9li0Ht+NAIm4Zt6ClQHteY4Wz3cnBnEa3DZBMLE5PpBPqfsiQUzQGGfbC/L X-Received: by 2002:a17:90a:62c1:b0:247:13f5:47de with SMTP id k1-20020a17090a62c100b0024713f547demr4836426pjs.44.1681464604416; Fri, 14 Apr 2023 02:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681464604; cv=none; d=google.com; s=arc-20160816; b=Fu68yTSLuJ5Uu1HWHFUXx5i9pNe4VgWTP7byDHVcH+BrGUKIKWsLPnekHE8j5ayAfD 4viW0uhyb+R9iRSL3aW6LdgEMXRMwGro1V+yQu2i2L0BKJyc5U1rUsZupg3BICKfYtcW O6kipDWHgKLaFXHm6+u2nJwx99HFaoKdTpDJ/tOf5j0QJeeJhHnY2y7SbeOZThDLN/5V G+FTJbLAQGyer1zBFPBONtCewytKPSHLIwzQyVGjHZNSF5IkLq7uVeNgyFO3ckKQRRgC bvMzmLfbvE+YybIkJoUaeO/4aqWl6VDYlZLSd1EAdPlv9zL/05o7xY+HCXd9OhulkEZr iGng== 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; bh=a8MiYNam0nDwFwB3ISUwXPU9++tI5ha1N9Pe3DCgOec=; b=ZUz2gGdhIhQLJd2SxgysF5my4eJcrcc8OqR3sE1C3jDvBl6nhH0ckvuSx8RTgeHwcY 94vwHcbYenhqq+H4ytW9NMqsIW4hFIcc96nielG5UvT2RceWNOmTWIgagsaTMJPPB6Lo ekldSZrLtwsw9Rd10OU75kMzR/QWjtHjWKJy5tkmSb4EVklTiQZSuaNoWk5oQ0b/thy8 SFvHYVUJ7Wx5b+ZIjTFx9a/D7kfc/gv/UFHGbv6WBkYaL4lY9Wp+sg7uQd8RFJK4D0ho Y4qcHjBliGgOIpFtX1bzcBc0HP0OlmJ3qrQsq1O20sGGUFltISz1TbQfl5r41utHX0Bt YtXA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb13-20020a17090b4a4d00b00246d4b17191si7909591pjb.177.2023.04.14.02.29.50; Fri, 14 Apr 2023 02:30:04 -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; 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 S229794AbjDNJXW (ORCPT + 99 others); Fri, 14 Apr 2023 05:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjDNJXU (ORCPT ); Fri, 14 Apr 2023 05:23:20 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D9121FD0 for ; Fri, 14 Apr 2023 02:23:18 -0700 (PDT) Received: from archlinux.localdomain ([10.12.190.56]) (user=zkhuang@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33E9JuZ5016647-33E9JuZ6016647 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 14 Apr 2023 17:19:59 +0800 From: zhengkang huang To: Matthias Brugger , AngeloGioacchino Del Regno Cc: zhengkang huang , Dongliang Mu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] soc: mdediatek: devapc: use devm_platform_ioremap_resource() instead of of_iomap() Date: Fri, 14 Apr 2023 17:21:13 +0800 Message-Id: <20230414092113.64514-1-zkhuang@hust.edu.cn> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: zkhuang@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 In mtk_devapc_probe(), if of_iomap succeeds and any following error occurs, it needs to deallocate the resource. Fix this by repalcing of_iomap with devm_platform_ioremap_resource, which automatically self-manages the resource. This can avoid modifying error handling code. Signed-off-by: zhengkang huang Reviewed-by: Dongliang Mu --- drivers/soc/mediatek/mtk-devapc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-devapc.c b/drivers/soc/mediatek/mtk-devapc.c index bad139cb117e..bea3ec8ab015 100644 --- a/drivers/soc/mediatek/mtk-devapc.c +++ b/drivers/soc/mediatek/mtk-devapc.c @@ -268,7 +268,7 @@ static int mtk_devapc_probe(struct platform_device *pdev) ctx->data = of_device_get_match_data(&pdev->dev); ctx->dev = &pdev->dev; - ctx->infra_base = of_iomap(node, 0); + ctx->infra_base = devm_platform_ioremap_resource(pdev, 0); if (!ctx->infra_base) return -EINVAL; -- 2.40.0