Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1716878ybl; Thu, 30 Jan 2020 04:52:42 -0800 (PST) X-Google-Smtp-Source: APXvYqw22VESOTuyAarwXLfk0cvYIhZr3RrX6+EoT8rDu48qE0aUJOA9Tom1CFe5kLDzWk4YWC6E X-Received: by 2002:a05:6830:14c9:: with SMTP id t9mr3245755otq.177.1580388762361; Thu, 30 Jan 2020 04:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580388762; cv=none; d=google.com; s=arc-20160816; b=VjPXIGdi3HN5MUBXmbi2exihLwi/v9wfyFBgd4ayu4IC4Tw9X3eFkPhjtQIZ8NmvDX Yz1524TzQ3CEelohwjyiSPt4TTPdCR6HFHtr7Znv/RxFvbzsD4xpiBzmfNXEWqP7IQkO cY/Fr6iAekG9t1T5yX1M5khFt0zCNm55wlkV+TJP+jxvehkjS9aJ0ZK/+1VcXIhqMgSt 8va3vXvHcV5+WQujAJcH3uJTDQGRiCqsTMTfYhQJU8wMKxWnq/r08VK3qxBPTtsJp8u3 PgorUrGwywuMLSLPD8v4/R6o/h0TZISN2LHzDRzVwLY/KOf1mLP+5bsaPKBqqXpyl3Hh XaGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cnMkth7hV/dDIq+IhUJB/NKhjbFoKZU6UHmqdZyzOvk=; b=ES7wecnJpDlkeRYYBQirtRS0pEWdkmGOpPVSUdmGdaKQTIz112wpqX/LdkBbBU2QiS Owv6gwIpXuD9gPxBnOHefdqr7tCL2AdeY8e0wY+8xzsf9pPJr3cSQFknLZ8DeaXCkZR3 I/EhnZeLrZPibO7Fc6Ft2KiLN/C39DUNhNCowI3j3fsVwd6qOCi3XeNxQ87/nYjsy74C fyiDBnAvPz0iakEcdLqMVjxWZRfyBCJjR214coz7jKKMm5qZ/ks4UJoAcRd6iyPE++Jj gWQEFftUZV1zt6rFZvNlW/u6H83TPRuGikf7wTbFYq3nnQJ5CHf60dvzOlbw/2VqpRJk uHmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQ6sBgIO; 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 r4si3032365otq.188.2020.01.30.04.52.30; Thu, 30 Jan 2020 04:52:42 -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=iQ6sBgIO; 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 S1727229AbgA3MuF (ORCPT + 99 others); Thu, 30 Jan 2020 07:50:05 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:39041 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbgA3MuF (ORCPT ); Thu, 30 Jan 2020 07:50:05 -0500 Received: by mail-ua1-f68.google.com with SMTP id 73so1098422uac.6 for ; Thu, 30 Jan 2020 04:50:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cnMkth7hV/dDIq+IhUJB/NKhjbFoKZU6UHmqdZyzOvk=; b=iQ6sBgIOXFS+YVl144eNLc5JpHouW0m9Ee9ZuD1cG7XWSQpQUoXytyz8oSzkhZCStz RZTGG/UeztBrkUBjBdU05mofzifuN+nig9XaIVD2qP13ClQ5vzEm8mV0oGvgEyJ8eYhX /R9MYyfdejs+BAuK4dUK30jQUu74dDMfXqdAEp8GqbsFavOT/fcqJUZjdg3rJ8H7uw1G OrSnyslcxopXLgogDTR1IOuPbWj5/+AkuPooBC+mX2YegTo7ytERWHloqLQz77bLGvR/ NeytO+8XzWfdENLpEts8kMEcNEHT/deUH8fwgQT339wOF7PF+oQBJr8l+TeJna6WzcGB 15Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cnMkth7hV/dDIq+IhUJB/NKhjbFoKZU6UHmqdZyzOvk=; b=tz4fI8xUbnhRRfHYp/SI6597vbw0EsQ2AYVWF8/3ITMbXDepMf4IuZETvfpAAG/7J+ 4JymChRVbtNp4phWlpaZqa7MxXDPo2x7VlNlVnRPPb/2POO7TDtLLGaT9bxORsGSAZF0 8TEqYf/KHPe6o1xAb1h58oemSGy7vL9OfHdWR3grI/viGQRjrDpN4qPufHzkBrUcDOpe nUUfV6PBFipefV+JXyA1p+hfDbk8EXJSkZhZ17AleGtxSr+WeiumASUpyzJxPry8HXPL 3RBEfuqN36sOroLc6Drf98JjkF6WWbzjkDjxMG49FMkHw1OldM86YMPgLM50wg2Vj1Jj XkUA== X-Gm-Message-State: APjAAAUoQLnOI/+1ib1CjXVHzF1//X8oQxupXIvcHIuuhjNEWiTrijwa D0sVN6y9XhL2fjmdiAiMynpHFd6+27wop8lc0m+Ulg== X-Received: by 2002:ab0:b94:: with SMTP id c20mr2456278uak.67.1580388603038; Thu, 30 Jan 2020 04:50:03 -0800 (PST) MIME-Version: 1.0 References: <0a969ecd48910dac4da81581eff45b5e579b2bfc.1577976221.git.amit.kucheria@linaro.org> <20200102192925.GC988120@minitux> In-Reply-To: <20200102192925.GC988120@minitux> From: Amit Kucheria Date: Thu, 30 Jan 2020 18:19:52 +0530 Message-ID: Subject: Re: [PATCH v3 4/9] drivers: thermal: tsens: Release device in success path To: Bjorn Andersson Cc: LKML , linux-arm-msm , Stephen Boyd , sivaa@codeaurora.org, Andy Gross , Linux PM list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 3, 2020 at 12:59 AM Bjorn Andersson wrote: > > On Thu 02 Jan 06:54 PST 2020, Amit Kucheria wrote: > > > 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. > > > > Given the relationship between priv->dev and op I think this wouldn't be > a problem in practice, but there's two devm_ioremap_resource() done on > op->dev in this function. So you're depending on op->dev to stick > around, but with this patch you're no longer expressing that dependency. > > That said, it looks iffy to do devm_ioremap_resource() on op->dev and > then create a regmap on priv->dev using that resource. So I think it > would be better to do platform_get_source() on op, and then > devm_ioremap_resource() on priv->dev, in which case the regmap backing > memory will be related to the same struct device as the regmap and it > makes perfect sense to put_device() the op->dev when you're done > inspecting it's resources. > Indeed, thanks for reviewing. Will fix. > > Signed-off-by: Amit Kucheria > > --- > > drivers/thermal/qcom/tsens-common.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > > index 1cbc5a6e5b4f..e84e94a6f1a7 100644 > > --- a/drivers/thermal/qcom/tsens-common.c > > +++ b/drivers/thermal/qcom/tsens-common.c > > @@ -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 > >