Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp841692rwl; Fri, 31 Mar 2023 03:14:58 -0700 (PDT) X-Google-Smtp-Source: AKy350Zmz5UX2zXwoChE48RuChUeo3yNmVSQXs5wy9WMzZLWNK9NZpGDXNkqeHV4EPBK8JxA0g5w X-Received: by 2002:a05:6a21:32a2:b0:df:e8b2:ffb4 with SMTP id yt34-20020a056a2132a200b000dfe8b2ffb4mr21299945pzb.3.1680257698660; Fri, 31 Mar 2023 03:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680257698; cv=none; d=google.com; s=arc-20160816; b=gaeUEtbJlm42Cej8IZMtGy3bnoVmJbhOQrmDKwU5iABx9mbpjptFGD1zrLC+f1zNiS 7OzL5ICog86hs6XRdf5sWxm78o6+GmfO591NNKYfA01O1ExlIPiSN+2uS1tWK+4uc8DX 2yKQGBuzm5XwyL26ER+d3VMvBnWsMSycDJ8ukR3nl0tbQrxrNDhfd0HzYBCTqOEyAA0D /okpQeEjcnDOP9ZDJRVs6ZoGJ+hz14EGfLB60ykiptOgvEh2qYqEPe+dmO/+etT+/nTH 0j3E6GZpfxfWRuQD+WGeW2dGBndRqRvvTy7AFPqik6Gun0V/0KN1a8voC1pSHC2mWvzP 5R0Q== 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=1m9fKvNUX8/TCHHOMvRhUZ0qUrfUp23X7qgBTbhouRo=; b=eEeNXAVNyQe7mguHcdWHMDWSSKmqjMqcfmdUEeTFfahMfTq1WRfRhFuTDP2/nqZcS0 XLh2n0uOmkNgtB7PPYxpgznyZoEfBU0MhBbEhiqfh7/D1E7bI80XduWvN9+num2r6QLJ arCWifLTkmBvrSL8DST4ryeA/RckVjL/yXG3oAQzfBj5w7G9+6IAyZTZ7G4rJO0hsdlW gl/sHWMcEifQlp4y4/nkEi7J/LeoljyMrLOZjOKqp88ddbkF6Y55/xqCu2DxBwXf/hO0 SB+MNHzQaj+9bw1cV3sxe6xruMhYxuYCi9DGmUvBRtc97zCe0ICs3Ewn4KOa3myFF5Yx rIsw== 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 p4-20020a63e644000000b00502e76a516csi1965757pgj.500.2023.03.31.03.14.46; Fri, 31 Mar 2023 03:14:58 -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 S230360AbjCaKOL (ORCPT + 99 others); Fri, 31 Mar 2023 06:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbjCaKNP (ORCPT ); Fri, 31 Mar 2023 06:13:15 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F8CF24AC1; Fri, 31 Mar 2023 03:07:48 -0700 (PDT) Received: from legion.. ([172.16.0.254]) (user=lidaxian@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 32V9tmlN007322-32V9tmlO007322 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 Mar 2023 17:56:17 +0800 From: Li Yang To: Geert Uytterhoeven , Magnus Damm , Lad Prabhakar , Biju Das Cc: Li Yang , Dan Carpenter , linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] soc: renesas: renesas-soc: release 'chipid' from ioremap() Date: Fri, 31 Mar 2023 17:55:44 +0800 Message-Id: <20230331095545.31823-1-lidaxian@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: lidaxian@hust.edu.cn X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 Smatch reports: drivers/soc/renesas/renesas-soc.c:536 renesas_soc_init() warn: 'chipid' from ioremap() not released on lines: 475. If soc_dev_atrr allocation is failed, function renesas_soc_init() will return without releasing 'chipid' from ioremap(). Fix this by adding function iounmap(). Fixes: cb5508e47e60 ("soc: renesas: Add support for reading product revision for RZ/G2L family") Signed-off-by: Li Yang Reviewed-by: Dan Carpenter --- drivers/soc/renesas/renesas-soc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c index 468ebce1ea88..51191d1a6dd1 100644 --- a/drivers/soc/renesas/renesas-soc.c +++ b/drivers/soc/renesas/renesas-soc.c @@ -471,8 +471,11 @@ static int __init renesas_soc_init(void) } soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); - if (!soc_dev_attr) + if (!soc_dev_attr) { + if (chipid) + iounmap(chipid); return -ENOMEM; + } np = of_find_node_by_path("/"); of_property_read_string(np, "model", &soc_dev_attr->machine); -- 2.34.1