Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2903775ybi; Thu, 4 Jul 2019 22:06:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyw/LqpN4e3G2u/4qGkSbd15eJczP4n/hDH/Mall6eo6fvd8dp/xOgITNVn8+s23P6FNuOa X-Received: by 2002:a17:90a:208e:: with SMTP id f14mr2305666pjg.57.1562303179522; Thu, 04 Jul 2019 22:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562303179; cv=none; d=google.com; s=arc-20160816; b=w9GXSELUQWSKYMWgmxrAb9dqbrdYXiV0hGebj6ufr7vTUTZ++THLUJuBUMglVebT7R eyMU4Qvs1K7yITtccEQ1lk+ak2ifP7SId5apRwng9nAFJArvmrMqXrCaLsSO65uAbd2G lzKUMDSB7sifPUxY4ulLkL+3CZxtFeJ8tNZ084KDTIG+EnAwH7Vf6U9V1XFqHW8h6aSK UKVE7ozV2pisamzqiOrMy0mCx7/viwZ8sY5jZnVq9BEfbq78551tmoaLl0a9PhqgeerS 4v5L4+MMh7c++b8ITGvHc1VX2yMYFXuMudHxLBLcprbdW1G91Qyw4Qg+nKadhgCay+IC VCsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Av3cm9sXrpZ61RFKRg+ZJ9gZK0Hgaa94z6oJvOkUjSI=; b=cKkr3TS7ucFWPDcG99/GEvAkM6+gFShy4IzryQeCmMKf1WKQphyUpNK283RA8AmuoN ucL3qagLjSXp8IP4dOWbWwiwa2g3kmNYW+C1MWrAxkQVBz0TM2uCcVUDkKNcL/9eZm/m dv2zKwpPb6lyXEDyH5eS2mqsqY3sG06ij4Fj0gXujCaA6TjdU13s5AHsV04DVGkZYwq0 fiIDY36lN+e/F9iqTsQHbghMj0oxZhGpSQReq0cw8d5QeESM5MLPdracdtEHzO950yiQ jEddxg9voNrreo9fnapX4mAwZ22AZf6RfUwf16V6DmvJKs1dpOlymhjlPpBHnWTQjS4n 6obQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf16si7377984plb.346.2019.07.04.22.06.04; Thu, 04 Jul 2019 22:06:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726887AbfGEFFg (ORCPT + 99 others); Fri, 5 Jul 2019 01:05:36 -0400 Received: from inva020.nxp.com ([92.121.34.13]:58100 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725681AbfGEFFf (ORCPT ); Fri, 5 Jul 2019 01:05:35 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 71DA11A0E8E; Fri, 5 Jul 2019 07:05:33 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 68F621A027F; Fri, 5 Jul 2019 07:05:21 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 9BF6E40297; Fri, 5 Jul 2019 13:05:07 +0800 (SGT) From: Anson.Huang@nxp.com To: rui.zhang@intel.com, edubezval@gmail.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, l.stach@pengutronix.de, abel.vesa@nxp.com, andrew.smirnov@gmail.com, angus@akkea.ca, ccaione@baylibre.com, agx@sigxcpu.org, leonard.crestez@nxp.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH 1/6] thermal: qoriq: Use devm_platform_ioremap_resource() instead of of_iomap() Date: Fri, 5 Jul 2019 12:56:07 +0800 Message-Id: <20190705045612.27665-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.14.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang Use devm_platform_ioremap_resource() instead of of_iomap() to save the iounmap() call in error handle path; Signed-off-by: Anson Huang --- drivers/thermal/qoriq_thermal.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 7b36493..c7c7de2 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -202,32 +202,27 @@ static int qoriq_tmu_probe(struct platform_device *pdev) data->little_endian = of_property_read_bool(np, "little-endian"); - data->regs = of_iomap(np, 0); - if (!data->regs) { + data->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(data->regs)) { dev_err(&pdev->dev, "Failed to get memory region\n"); - ret = -ENODEV; - goto err_iomap; + return PTR_ERR(data->regs); } qoriq_tmu_init_device(data); /* TMU initialization */ ret = qoriq_tmu_calibration(pdev); /* TMU calibration */ if (ret < 0) - goto err_tmu; + goto err; ret = qoriq_tmu_register_tmu_zone(pdev); if (ret < 0) { dev_err(&pdev->dev, "Failed to register sensors\n"); - ret = -ENODEV; - goto err_iomap; + goto err; } return 0; -err_tmu: - iounmap(data->regs); - -err_iomap: +err: platform_set_drvdata(pdev, NULL); return ret; @@ -240,7 +235,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev) /* Disable monitoring */ tmu_write(data, TMR_DISABLE, &data->regs->tmr); - iounmap(data->regs); platform_set_drvdata(pdev, NULL); return 0; -- 2.7.4