Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753582AbbKILQE (ORCPT ); Mon, 9 Nov 2015 06:16:04 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:42847 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750804AbbKILPn (ORCPT ); Mon, 9 Nov 2015 06:15:43 -0500 Date: Mon, 9 Nov 2015 11:15:15 +0000 From: Russell King - ARM Linux To: Liviu Dudau Cc: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , dri-devel , linux-rockchip , LAKML , LKML Subject: Re: [RFC PATCH v3 1/4] drm: Introduce generic probe function for component based masters. Message-ID: <20151109111515.GW8644@n2100.arm.linux.org.uk> References: <1445267270-23126-1-git-send-email-Liviu.Dudau@arm.com> <1445267270-23126-2-git-send-email-Liviu.Dudau@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1445267270-23126-2-git-send-email-Liviu.Dudau@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2026 Lines: 57 On Mon, Oct 19, 2015 at 04:07:47PM +0100, Liviu Dudau wrote: > A lot of component based DRM drivers use a variant of the same code > as the probe function. They bind the crtc ports in the first iteration > and then scan through the child nodes and bind the encoders attached > to the remote endpoints. Factor the common code into a separate > function called drm_of_component_probe() in order to increase code > reuse. Sorry, I take back my Acked-by. > + /* > + * Bind the crtc's ports first, so that drm_of_find_possible_crtcs() > + * called from encoder's .bind callbacks works as expected > + */ > + for (i = 0; ; i++) { > + port = of_parse_phandle(dev->of_node, "ports", i); > + if (!port) > + break; > + > + if (!of_device_is_available(port->parent)) { > + of_node_put(port); > + continue; > + } > + > + component_match_add(dev, &match, compare_of, port); > + of_node_put(port); We shouldn't be putting the ports here - we're still retaining a reference against the port, even though it's by address. Yes, we have no way to release this reference, which probably ought to be fixed. Please replace this of_node_put() here with a comment to that effect. > + for_each_child_of_node(port, ep) { > + remote = of_graph_get_remote_port_parent(ep); > + if (!remote || !of_device_is_available(remote)) { > + of_node_put(remote); > + continue; > + } else if (!of_device_is_available(remote->parent)) { > + dev_warn(dev, "parent device of %s is not available\n", > + remote->full_name); > + of_node_put(remote); > + continue; > + } > + > + component_match_add(dev, &match, compare_of, remote); > + of_node_put(remote); Same here. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/