Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3749437imu; Mon, 14 Jan 2019 08:23:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN7id3Z9yqSXc/a3hXO8iqDTWhIUCGIFFZ+XB5LiFUlNhbrKzvjPqBzCBArEQZPuZlj7q8id X-Received: by 2002:a63:ea15:: with SMTP id c21mr22372869pgi.361.1547482995939; Mon, 14 Jan 2019 08:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547482995; cv=none; d=google.com; s=arc-20160816; b=tY5goEMnbB8AhAFyTkozNq8FSXo2imAKQGK1WAaxPRmIs8Fy/Ckleo/qJQ36+mayBE dqlxTK0rV4EDVdjaOLtSaoUahi1TDSvPqeruQg5TNQDTE9We31xCRz7hBBzMEAAO6qIR tBUamcgst8jyZaFy/tknM7aF+K1SCdN73i1JCFr0YDd8un0+eCcpnYh1Kv5gwwskj3FT 6+xyyGmUqAhey19HCBJVsq4Zvv6TKFmuF88yxCVtVwIx9UKnb+2l5aqBMSZY8z88y/Fw GC38XyoCZwhtG1VGFJQ26BKBr55I+VSAapTV1IgO8/o+fu+ZzH9v+zbKdgneaC83LmiF yKNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=ucgWcZXjMtgLJ3J20be+7M2HgHqVUtzYoAaQcZuTl+4=; b=s18xgu1/QydUXkL4iR6RQ5oR5bgYvrl8hg3simL+vbKBrZOyzrWFJZsypq8OOCDQnh LIuFGsSj/COx+kwQ/cgMons+WCMGaQ6fPoCEq1j+9Qi48pXmg7jJwWFIsiYCm4FOqWWi X14R6dSCtXeR8ms5nnktYn205b+PZgpqyHFau1n4GzwLjiCt+DU2FjlxyjfDUKIBF1tW I9RUYKYRqVB9mBPdQRJwH3uoEN5/TuXJcWLD99V3fXBpLjNkzrMnNCpqrOLzb3wm0x3o nxOo8yu0jd8r5Zz6ZHHKc0WN2IJ2fkVBK449auZ/pWJliZ1CDtB6MglhKmBo/CjUPaer ef8A== 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 27si635506pgu.421.2019.01.14.08.22.47; Mon, 14 Jan 2019 08:23:15 -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 S1726769AbfANQTy (ORCPT + 99 others); Mon, 14 Jan 2019 11:19:54 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:36303 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbfANQTx (ORCPT ); Mon, 14 Jan 2019 11:19:53 -0500 X-IronPort-AV: E=Sophos;i="5.56,478,1539640800"; d="scan'208";a="291882267" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2019 17:19:49 +0100 Date: Mon, 14 Jan 2019 17:19:47 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Kieran Bingham cc: Laurent Pinchart , kernel-janitors@vger.kernel.org, David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] drm: rcar-du: add missing of_node_put In-Reply-To: <78d7667d-f701-b908-9f24-0ee13be90947@ideasonboard.com> Message-ID: References: <1547372691-28324-1-git-send-email-Julia.Lawall@lip6.fr> <1547372691-28324-2-git-send-email-Julia.Lawall@lip6.fr> <78d7667d-f701-b908-9f24-0ee13be90947@ideasonboard.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 Jan 2019, Kieran Bingham wrote: > Hi Julia, > > Thank you for the patch, > > On 13/01/2019 09:44, Julia Lawall wrote: > > Add an of_node_put when the result of of_graph_get_remote_port_parent is > > not available. > > > > The semantic match that finds this problem is as follows > > (http://coccinelle.lip6.fr): > > > > // > > @r exists@ > > local idexpression e; > > expression x; > > @@ > > e = of_graph_get_remote_port_parent(...); > > ... when != x = e > > when != true e == NULL > > when != of_node_put(e) > > when != of_fwnode_handle(e) > > ( > > return e; > > | > > *return ...; > > ) > > // > > > > For this part at least: > > Reviewed-by: Kieran Bingham > > But a little discussion below: > > > > Signed-off-by: Julia Lawall > > This does indeed look like a missing of_node_put() but I don't think it > will be the only one in that code. It gets a bit tangled - and I think > there's possibly another missing put on the error path of > > if (!encoder) { > dev_warn(rcdu->dev, > "no encoder found for endpoint %pOF, skipping\n", > ep->local_node); > return -ENODEV; > } > > because that implies that no encoder was found, and thus - > encoder = entity; > > was not executed, and the tail of that function calls: > > of_node_put(encoder); > > which would have been the final of_node_put(entity) Looking at it again, I agree. I can just extend this patch. julia > > > I think that part could be considered separate to this patch, but it's > also quite closely related. Either way - I think it needs a second pair > of eyes to see if I'm not crazy :) > > Regards > > Kieran > > > > > --- > > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > index 9c7007d..bc3fcb3 100644 > > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c > > @@ -331,6 +331,7 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, > > dev_dbg(rcdu->dev, > > "connected entity %pOF is disabled, skipping\n", > > entity); > > + of_node_put(entity); > > return -ENODEV; > > } > > > > > >