Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1280773imu; Wed, 16 Jan 2019 16:18:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4nZhgxRPE9t3dox6HPVz6noMbngx19Bb4GfLLldl3LOJQ6ucQd2+zsYlSkKXuigvTkEet0 X-Received: by 2002:a62:c42:: with SMTP id u63mr12387307pfi.73.1547684330870; Wed, 16 Jan 2019 16:18:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547684330; cv=none; d=google.com; s=arc-20160816; b=AKj3M+D4brdjibuMMPNdkWen3yohrpij+zFGZjS7o87lCQNi7UH3hIzcDcyIIMiljL Jn2l5IQAE2hLEuM8mpxDNiaWN+Re5O2ptbSXR5o8rxe6Y8pauIzoXqHCO7eK3dWHNY59 /TDylh8ymFSopfTxLr4efQ+ZP5XpxK0MNIVfdXc8lM7fyBnBL4RiOyljNZKuA1z2js0s cnReRyPnhPPUvk0fw/TerAs8cnQq3LaDxeLCtUuMMnooXgfISTAoPnaUAGRm//+SMauZ x+8ZbFTitQ3bbmy6UFlnS0e9gt8+OSamw2/oMxK9Tkn2CGbovJ8xtUYI/xn7tpWWhXkU hN7A== 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; bh=rzWJf/Vgu3y8gJxpw9QpDe1xKo6K+360ZYB3sr7Kj2g=; b=yZB5IIK4YLzzjcLg3btbhmnoP/R0u0H2E6BXzbla7Ra01fLNq4CadXt614ml5S6aDi VBZvrnobO0qsZGAhaG9kAxt+8qti4eYiYprxXIivlBC4Ytgkqf40JthCtPChKzzyMKiL KVqJDw7D7w4ZCcH1Qyb+Pvwe5g/AlwWd9NXGNcCH1oPore2miydUNaw+YKcbC5mNTLy0 Iph3nKbq9Syi4iAhQ87p944GBSMUDX7CSrwQKuhQHdHXEk6N5NHyihxl08hEeH+GJMZs n6tASHwZl7vzCdHqMhDTQid3DiDkoefN96Got3vc6/T5Ywjf7NqyPEdI2rqYg1boOM7Z qmew== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si6870886pgp.307.2019.01.16.16.18.32; Wed, 16 Jan 2019 16:18: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730626AbfAPTSJ (ORCPT + 99 others); Wed, 16 Jan 2019 14:18:09 -0500 Received: from mail.bootlin.com ([62.4.15.54]:43665 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730169AbfAPTSJ (ORCPT ); Wed, 16 Jan 2019 14:18:09 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 2B5D1209EF; Wed, 16 Jan 2019 20:18:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (unknown [212.81.177.10]) by mail.bootlin.com (Postfix) with ESMTPSA id C9C10206A6; Wed, 16 Jan 2019 20:17:56 +0100 (CET) Date: Wed, 16 Jan 2019 09:59:13 +0100 From: Maxime Ripard To: Julia Lawall Cc: kernel-janitors@vger.kernel.org, David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] drm/sun4i: backend: add missing of_node_puts Message-ID: <20190116085913.j2ju3mj75x5bqppm@flea> References: <1547369264-24831-1-git-send-email-Julia.Lawall@lip6.fr> <1547369264-24831-5-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dunppgcxmo5qgg5l" Content-Disposition: inline In-Reply-To: <1547369264-24831-5-git-send-email-Julia.Lawall@lip6.fr> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --dunppgcxmo5qgg5l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 13, 2019 at 09:47:44AM +0100, Julia Lawall wrote: > The device node iterators perform an of_node_get on each > iteration, so a jump out of the loop requires an of_node_put. >=20 > Remote and port also have augmented reference counts, so drop them > on each iteration and at the end of the function, respectively. > Remote is only used for the address it contains, not for the > contents of that address, so the reference count can be dropped > immediately. >=20 > The semantic patch that fixes the first part of this problem is > as follows (http://coccinelle.lip6.fr): >=20 > // > @@ > expression root,e; > local idexpression child; > iterator name for_each_child_of_node; > @@ >=20 > for_each_available_child_of_node(root, child) { > ... when !=3D of_node_put(child) > when !=3D e =3D child > + of_node_put(child); > ? break; > ... > } > ... when !=3D child > // >=20 > Signed-off-by: Julia Lawall Applied, thanks! Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --dunppgcxmo5qgg5l Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXD7yYQAKCRDj7w1vZxhR xYlyAQDwvaT1Fd85U90xXfnNEaXT0VONYRQBfzXkZ5deO8x8igEA+PXurQWESJMf cVGPanmyDaAWOtjRbYLKr4Tkn8cthAk= =7q2T -----END PGP SIGNATURE----- --dunppgcxmo5qgg5l--