Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1753480ybl; Thu, 30 Jan 2020 05:28:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxGeIfLeQTRIhzmpEc3LxBnwbIaYi/PGKV+IpOnxXSYJ40ONNYnH6dNfnjPJWxL+qaVtxVV X-Received: by 2002:a9d:6e14:: with SMTP id e20mr3685866otr.283.1580390930020; Thu, 30 Jan 2020 05:28:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580390930; cv=none; d=google.com; s=arc-20160816; b=TdD36vAMR6eXwnZGX0XWEAOeV8D0z9y0h1mIUvJlovYGscL7vR2OWYRP5Ik+Mv0Xhg 62WcNvihAvqGG1BVYgHlH/3j7FtRadWhNyYWBrwEIrQHAkIHVylM0q3RXkQtZxKL/5bI a12QB90hrn0Y9ak2VqcT1J+9GQPXiEyUWk3S4nRsdAgaHqPlHPbUrhigpizNqFPr3USq fKqkkJnA2YXy3zR2zx4BIs3W8skVoI/F85yS/LeTdlMmbWoVHmee5RtPEECYFopPxsLc IgtWyi1isRYxdFs0B6GPpJlsaTRBTR/u/pZesEwPWlHocutU/XLWeb2W50cLiRsEXFkc P/dQ== 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=LlTOqa7aJHLIIA8wM9T5y4yWDZPqvXEMyPc1NafC2uQ=; b=njbOuXTZl4nhTf7/SBMlZIZBc7PePpr5y8Sdyiyl5becIhw3dgeL7zzD4pVn5Uwam0 DWmguJzOjG0fuHIgLFPDtKECDNyWBoHD/a4/G7Fr1xMxUq/msaKfBuCOPyc2zneafd9N NDfYEb5bCRwMJz2zLMIqtg9xxm2AyBb9mqcRVzVX+jwBkiygbDasYWU/UAjRlBLQl2a9 hXAO1vF1fBHKeJ+Az+dduk3K20YYkBd5JEj8K0MbgT+ggPWsIXh8jbhieeL8zEx+FvKF w9bDXsRAhXIiFQ7vKgZcRmkwOou7voeAQby06D17hPLva/tNuoXBuk/kJWnJY9Rt3N00 VVdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TdFEi2Fr; 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 u21si2783189oiv.267.2020.01.30.05.28.38; Thu, 30 Jan 2020 05:28:50 -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=TdFEi2Fr; 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 S1727441AbgA3N1b (ORCPT + 99 others); Thu, 30 Jan 2020 08:27:31 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45347 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727313AbgA3N13 (ORCPT ); Thu, 30 Jan 2020 08:27:29 -0500 Received: by mail-pf1-f194.google.com with SMTP id 2so1481636pfg.12 for ; Thu, 30 Jan 2020 05:27:29 -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=LlTOqa7aJHLIIA8wM9T5y4yWDZPqvXEMyPc1NafC2uQ=; b=TdFEi2Frmszieg86oOD2LCWLCg4E0GtJkmryHCl6IjbDA7EYELAoVIoZMlEP7W26Lv ybBx6uaIq9O8sDRXOWRV2SiK8SPFs+IHW4z6vKVpTUu2E85oS8K5jufdqSbPxwp2duK9 +UtWqwSgPOqI5THsCSBqyDmZCgPJCqZZTKC9kUQcMqPv49v9n5BYj4UGVbXP3DL6koHI Ph/TeuAhQN+Kjv6URJj9jkNGHO7VONP0o4z9ovj05WkJlP9kAR2Y3KVTjSRhQ5vxV4zy 5VpHRKX83Kt/Agm+gVCxE6ndEhtYhFhE3WKJcuBDb3bt+wz5mUOA0I0SY2hguuHIXrwK 46vg== 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=LlTOqa7aJHLIIA8wM9T5y4yWDZPqvXEMyPc1NafC2uQ=; b=RgcIKEBY85S/lK/+3fr3s/3X19IludYINeNtqAJMcdwGSt1okjXt+dUoWobmBPISzg bZAOSHp4cFpvxDzz6dF3dCZlyAAgRTTLQXoZsFaFUpK40gsTR270XanoIvRE/zR8FPvE hrmLfOAZvLUT5+mmtEuWJqkSxg8hHcGv6q/Flg7s5qQqRjgoZl391IEcJaL/YV3rUV3G IUEqTFX9RlYcRIUZ4gGyqf+gQ0eZRyrIgXP7SSBjK9NhpRrQnzQUiBjwqWVR0vWu98lt YQ5zFPrEPFWQGZs0Ppxjfpf22jyj2izOybScW1y2jEqqXn0mHCnJULFCs8jv9i42Cum4 HzHg== X-Gm-Message-State: APjAAAU814DT5C/74MdqjGbc24OiD14BeUa2ProWCbnm/85TIc+QhAp0 voF7FAXyPvCFdAAgI33oejCXFSWxVu1hKw== X-Received: by 2002:a63:d14:: with SMTP id c20mr4564044pgl.77.1580390848719; Thu, 30 Jan 2020 05:27:28 -0800 (PST) Received: from localhost ([45.127.45.97]) by smtp.gmail.com with ESMTPSA id o184sm6543006pgo.62.2020.01.30.05.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2020 05:27:27 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, swboyd@chromium.org, sivaa@codeaurora.org, Andy Gross Cc: Amit Kucheria , linux-pm@vger.kernel.org Subject: [PATCH v4 3/7] drivers: thermal: tsens: Release device in success path Date: Thu, 30 Jan 2020 18:57:06 +0530 Message-Id: <332d79312d2618c96adaa0f125ea033e49f0af5d.1580390127.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 --- 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