From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753880AbcGDOLl (ORCPT ); Mon, 4 Jul 2016 10:11:41 -0400 Received: from zencphosting06.zen.co.uk ([82.71.204.9]:34866 "EHLO zencphosting06.zen.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753025AbcGDOLi (ORCPT ); Mon, 4 Jul 2016 10:11:38 -0400 Subject: Re: [PATCH v2 1/8] Input: synaptics-rmi4: Increment the refcount of the transport dev's of_node To: Andrew Duggan , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org References: <1466813877-15737-1-git-send-email-aduggan@synaptics.com> Cc: Dmitry Torokhov , Linus Walleij , Jiri Kosina , Benjamin Tissoires , Vincent Huang From: Nick Dyer Message-ID: <7b938ff8-1e60-5ff1-4f86-7035f1252828@itdev.co.uk> Date: Mon, 4 Jul 2016 15:11:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1466813877-15737-1-git-send-email-aduggan@synaptics.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-1.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - zencphosting06.zen.co.uk X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - itdev.co.uk X-Get-Message-Sender-Via: zencphosting06.zen.co.uk: authenticated_id: nick.dyer@itdev.co.uk X-Authenticated-Sender: zencphosting06.zen.co.uk: nick.dyer@itdev.co.uk Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/06/2016 01:17, Andrew Duggan wrote: > Increment the refcount for the transport device's of_node before calling > of_find_node_by_name(). Since of_find_node_by_name() assumes the refcount > was incremented by the caller and calls of_node_put() when it is done. > > Signed-off-by: Andrew Duggan > --- > drivers/input/rmi4/rmi_bus.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c > index b368b05..55b5336 100644 > --- a/drivers/input/rmi4/rmi_bus.c > +++ b/drivers/input/rmi4/rmi_bus.c > @@ -157,11 +157,12 @@ static int rmi_function_match(struct device *dev, struct device_driver *drv) > static void rmi_function_of_probe(struct rmi_function *fn) > { > char of_name[9]; > + struct device_node *node = fn->rmi_dev->xport->dev->of_node; > > snprintf(of_name, sizeof(of_name), "rmi4-f%02x", > fn->fd.function_number); > - fn->dev.of_node = of_find_node_by_name( > - fn->rmi_dev->xport->dev->of_node, of_name); > + of_node_get(node); > + fn->dev.of_node = of_find_node_by_name(node, of_name); Could this be changed to of_get_child_by_name() (which doesn't call of_node_put) instead of doing the refcount hack? > } > #else > static inline void rmi_function_of_probe(struct rmi_function *fn) >