Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6117919ybv; Tue, 18 Feb 2020 10:14:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzEAIdorJ0apGKN90JZtLJjjERA2QAji1C8YcXtdvI6c+4XIkL3IMcQl9K00IR5xQoclivI X-Received: by 2002:aca:2207:: with SMTP id b7mr2138673oic.109.1582049658792; Tue, 18 Feb 2020 10:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582049658; cv=none; d=google.com; s=arc-20160816; b=ZivURmbfNmh8Ei3G7KEVNWFc3If3q2vjMwet9N/0e3iqBlH67SeVM+uP4hV+yCEvbe 5wkhzAzstNy3KMQPZnn7w6xW2AKpfuoE9ig0Ji8BFwu8bfrfo9zJArC3ordBbAB2gv4g RWjU+brabEUQNW/GJzODewebTFcgMgs7BN9H2zxuBP0YT8aO+kiobKji9jLbhznaENPn OHNENvWBRdYPRLBSAzpwLal0wUwbSbrho10RrouDlYW5ccwaBttt4URzpSC662vBSUDN 6LivKucHEX72jL2aRy5Pk/5VfOAw1dOf5dR8QKiqa67lcAiR0JbX3iOUsL6T3EpW5tLp LNTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+YirIPkJXuIir4GmYePAIggm+McOm90/Zl24VPr8SRk=; b=uuyt8ipHjO2zoub6pk2kN/yUFIz+azl1ju+eGNAEnaYgCMp2JEk/ka7XhPAGTc4igS mz/+HBIvMEFSKT1octUtzWwxogCMIv+r/LqosrpNAGq1hWEuohYKMp7QnCgJThaSwRA8 yVP1r0bZ9Z5j8PUVCJlSvoUwmnQRW3vT7ZX8gkb4Sk1a+CTfaL5xTxuhaMPwRygGPRuY jegNXhO74gmcFE8haMRYEW6TvnYW+M/sMDLRBStf4+LqX0fQ2kb6l90ianyNRTIPxU/r a06gu+ZLMEvyHEhA5FaNif5LU94WXbzF7zejQPTexpGpk2LPMUx77QBDTSwfOLC/Y+59 X27A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jswkyQD1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si2103391oti.283.2020.02.18.10.14.06; Tue, 18 Feb 2020 10:14:18 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=jswkyQD1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726713AbgBRSMi (ORCPT + 99 others); Tue, 18 Feb 2020 13:12:38 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45336 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbgBRSMh (ORCPT ); Tue, 18 Feb 2020 13:12:37 -0500 Received: by mail-pf1-f195.google.com with SMTP id 2so11032712pfg.12 for ; Tue, 18 Feb 2020 10:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+YirIPkJXuIir4GmYePAIggm+McOm90/Zl24VPr8SRk=; b=jswkyQD1LeaxGwcvJdqJn4XVZpLtuqcbPeNaccCVCjIcpcOu1rNR8vdETNL96gZ0zh RyXsscw4Ue6zgjpT9/vA8qBcST12eb4siBsq/WB/BVDevcco5oXYHfqdHUDGj+hDnuer a+fjOaVCL+Mvl+hxpBr9qDGb9Eh0cGPHaT6OFsWumb8OLgipOUEdoWo3HMshBvf/o3fD X21CXstzSwaR+bxdSBss8UP1wggaxiNWdklCbT4T9C+Glx9c7fx9upfKRyCfHGj/A5ZS 9CHh+Fu/vTwCT4XHAOxTLHDBUNpTztJbNVdAaxAqAeqLJb5cixhkQGPaONXZELDELAaM d7yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+YirIPkJXuIir4GmYePAIggm+McOm90/Zl24VPr8SRk=; b=R3Nyl25YpHGlInvqfPOn6XIpD5Io/OmC4ySh0WukKggvUX9jKKuOmRKnnpvBHvy5Vu ot1z8tEBtCxMv8ngHPjliE5IYu9+tc2o/4EhB8/27SD5C6ONv0NeNRMM+jYOhr9LaDUj q4W7R10Jxj6nTmuSTTOu7Yh06RcbYLBCRGHAHFYctAnYQWmEuP1YI1p31iEZf27M+3ci cT5fMuSnzSntiZWAtYif3ls/ouMJCzwf2cnaVsKkVTAauIz2kNfZz4c8gwlmn2KLNeAB dFcuGQcsktasSPAvrzaAVz6neHPgtwRwMJNJZATqKzDL4C28BDcBgkDPS11+rcR+YLAV 7/9g== X-Gm-Message-State: APjAAAWQnEVVzt+L3WZXt9J/glSJOogecvh6EqrrozeovlmnbFwxhPMx IiEPNoHxiAO+8pVzgSMqLww2SEj7/9s= X-Received: by 2002:a62:1889:: with SMTP id 131mr22541039pfy.250.1582049556211; Tue, 18 Feb 2020 10:12:36 -0800 (PST) Received: from localhost ([103.195.202.120]) by smtp.gmail.com with ESMTPSA id b25sm4888300pfo.38.2020.02.18.10.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 10:12:35 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, swboyd@chromium.org, sivaa@codeaurora.org, Andy Gross Cc: Amit Kucheria , linux-pm@vger.kernel.org Subject: [PATCH v5 4/8] drivers: thermal: tsens: Release device in success path Date: Tue, 18 Feb 2020 23:42:08 +0530 Message-Id: <9fa8a4e09b6fcff4b9d4facc9f9e9f8e3c4a41d5.1582048155.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We don't currently call put_device in case of successfully initialising the device. Allow control to fall through so we can use same code for success and error paths to put_device. As a part of this fixup, change devm_ioremap_resource to act on the same device pointer as that used to allocate regmap memory. That ensures that we are free to release op->dev after examining its resources. Signed-off-by: Amit Kucheria Reviewed-by: Bjorn Andersson --- drivers/thermal/qcom/tsens-common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 1cbc5a6e5b4f..013750fff8b2 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -602,7 +602,7 @@ int __init init_common(struct tsens_priv *priv) /* DT with separate SROT and TM address space */ priv->tm_offset = 0; res = platform_get_resource(op, IORESOURCE_MEM, 1); - srot_base = devm_ioremap_resource(&op->dev, res); + srot_base = devm_ioremap_resource(dev, res); if (IS_ERR(srot_base)) { ret = PTR_ERR(srot_base); goto err_put_device; @@ -620,7 +620,7 @@ int __init init_common(struct tsens_priv *priv) } res = platform_get_resource(op, IORESOURCE_MEM, 0); - tm_base = devm_ioremap_resource(&op->dev, res); + tm_base = devm_ioremap_resource(dev, res); if (IS_ERR(tm_base)) { ret = PTR_ERR(tm_base); goto err_put_device; @@ -687,8 +687,6 @@ int __init init_common(struct tsens_priv *priv) tsens_enable_irq(priv); tsens_debug_init(op); - return 0; - err_put_device: put_device(&op->dev); return ret; -- 2.20.1