Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2341640imm; Mon, 16 Jul 2018 06:31:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcNR2dy3n44k9v3w2iMj8GfBKrpFgf3DUZO8+IF+ijUAtAHpMPaQ51nQfGwp6aMa7LZkToo X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr1745566pgh.369.1531747864251; Mon, 16 Jul 2018 06:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531747864; cv=none; d=google.com; s=arc-20160816; b=qmgGN9p3gNiz3s+QZijgTDZkhWv4ZBaepZyp89Uc2w9EJiqeGrKPIf/OeXoI8cFvZR XqyR4Qf6VTwy5q7fVtBYHrzOZjS7NhcDO/BCEoHHWj2EAin+C2/bXFEzGfYQwvkRhs8r Bmu79TZa1QjqtwFLyfGzyIBts41yqJR253cAVrFo8OLuD3Mf4l+aD8r2q6eg8LguEzBj ua3q19fQmMQsdLfdJ0lP0KRP4wxMfUDMXk/Hh9r7ur+g6y4+wZ4ISiGdYQv7Y0wsvQ8r 1gseMtkeU3W+p6yO9vw9ZNR/yv99LsXcb1LA6ybVOAruK2QzhIBqTD1lmjgYa5visZsx cLAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hFpfV/8/4t41JlmGRDi2sHBMmsdmb+M1XJbK8bqJVxI=; b=KvETlw8kcQL4lAdlgfHEyeLlvNxtd6cDZHzZ5XCMjy8MpK/w9uzBeB4ei/+dNJJW42 5T+xvAe7Kw0NcqxkdeJtKJVMfVPe6Os0ioYWSYTsU+R+5WF2fC5/EZ0ub59YM1jCF4An Q9dUsKOnDQClZOxNuyCv9p5XxdLrG5zb6WuovReKJmmEDWjniFj/nHIXRc7hSTI+B4fW N7pVrny4gjAD5XRIM4wkTPSEAM3+dVEMQX/lmkR6DETDtzkKxTMCOZ1jE6LQ8Ed9Gr4T 9Y0nP4zrOZgg9WUiOhSwMQpHU+obxC9FGBEvYu+PPxJsNuT89a6r9JXjWZkYUJn2FOc0 /8wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YRkL0k2o; 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 h4-v6si29608523pgm.441.2018.07.16.06.30.49; Mon, 16 Jul 2018 06:31:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=YRkL0k2o; 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 S1727561AbeGPN5D (ORCPT + 99 others); Mon, 16 Jul 2018 09:57:03 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42846 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727479AbeGPN5D (ORCPT ); Mon, 16 Jul 2018 09:57:03 -0400 Received: by mail-lj1-f194.google.com with SMTP id x12-v6so4292037ljj.9 for ; Mon, 16 Jul 2018 06:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hFpfV/8/4t41JlmGRDi2sHBMmsdmb+M1XJbK8bqJVxI=; b=YRkL0k2o0G68TKhE03GPOSZ1Vx0EfmgAX5u+TbwOrP+DNr4MrOz+OVutJPeP7ORI27 7DCj26GMXBA9oadDG8msiStPG5/PRw7LCpog3VWvzpupRcjwWusk9iFNIE1WIdE0VOCR SMrmHIqYUKU+AdhXkovFS/jI9LX57jYncmEYA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hFpfV/8/4t41JlmGRDi2sHBMmsdmb+M1XJbK8bqJVxI=; b=CSeSdvRW99OSahPfoWj2YcpiirHUlUMNN/91iOKk0+pCLwWtuLGCP+vCB3WwWgPSev F0wfCPxPgUDaC/g+C416BDbZSRZmvyPfSk4CUh1H4HGYZekhK8wAArfp6ZqxhwkQqHQa IG2DFSBpnjEMBS8lGO4CYQ0cy7gQ5gK5+vHJbznfdJlD5ATlS5XbPmDpheZXGWMA3f67 PzfBYFsZncjiTkiL07h/YYUFNGUh6KP0N4si0j4fN27EZR7GwL+SAHpB/pKaKVRzjsrO XJG6ktxmp8lnCH/gyUH5fiIb/uDqrPgew44/2imzY3xn7nsD8ZQ6Ewshs4MROAFAnaTf m9NA== X-Gm-Message-State: AOUpUlHLjo/1YCGdq3a0vE/AOn/UwMtE6rcFvvCQOSL3ZONJ4e+T3R7C 6AC5JUf4sLBHu7jwqh0Jdz0ykw== X-Received: by 2002:a2e:9105:: with SMTP id m5-v6mr10053622ljg.121.1531747774697; Mon, 16 Jul 2018 06:29:34 -0700 (PDT) Received: from centauri.lan (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id p20-v6sm608966lji.13.2018.07.16.06.29.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 06:29:34 -0700 (PDT) Date: Mon, 16 Jul 2018 15:29:31 +0200 From: Niklas Cassel To: Johan Hovold Cc: broonie@kernel.org, Liam Girdwood , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] regulator: qcom_spmi: Fix warning Bad of_node_put() Message-ID: <20180716132931.GA866@centauri.lan> References: <20180716113525.9335-1-niklas.cassel@linaro.org> <20180716113525.9335-2-niklas.cassel@linaro.org> <20180716120134.GL10204@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180716120134.GL10204@localhost> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 16, 2018 at 02:01:34PM +0200, Johan Hovold wrote: > Hi Niklas, > > On Mon, Jul 16, 2018 at 01:35:22PM +0200, Niklas Cassel wrote: > > For of_find_node_by_name(), you typically pass what the previous call > > returned. Therefore, of_find_node_by_name() increases the refcount of > > the returned node, and decreases the refcount of the node passed as the > > first argument. > > > > However, in this case we don't pass what the previous call returned, > > so we have to increase the refcount of the first argument to compensate. > > I don't think this is the right fix. of_find_node_by_name() should > generally not be used by drivers in the first place as it searches the > entire tree and can end up matching an entirely unrelated node. > > I haven't looked at the device-tree binding in question, but you > probably want to use something like of_get_child_by_name() instead. > Hello Johan, of_find_node_by_name() will only search the whole tree if the first argument is NULL, which isn't the case here. However, of_get_child_by_name() is indeed better suited here. Will send out a v2. Thank you for your feedback, it is much appreciated :) Kind regards, Niklas