From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755838Ab3GAUSr (ORCPT ); Mon, 1 Jul 2013 16:18:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49057 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755201Ab3GAUKj (ORCPT ); Mon, 1 Jul 2013 16:10:39 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Yuantian , Grant Likely , Guenter Roeck Subject: [ 23/26] of/base: release the node correctly in of_parse_phandle_with_args() Date: Mon, 1 Jul 2013 13:10:18 -0700 Message-Id: <20130701200732.480333896@linuxfoundation.org> X-Mailer: git-send-email 1.8.3.rc0.20.gb99dd2e In-Reply-To: <20130701200729.872850414@linuxfoundation.org> References: <20130701200729.872850414@linuxfoundation.org> User-Agent: quilt/0.60-5.1.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tang Yuantian commit b855f16b05a697ac1863adabe99bfba56e6d3199 upstream. Call of_node_put() only when the out_args is NULL on success, or the node's reference count will not be correct because the caller will call of_node_put() again. Signed-off-by: Tang Yuantian [grant.likely: tightened up the patch] Signed-off-by: Grant Likely Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1166,11 +1166,11 @@ static int __of_parse_phandle_with_args( out_args->args_count = count; for (i = 0; i < count; i++) out_args->args[i] = be32_to_cpup(list++); + } else { + of_node_put(node); } /* Found it! return success */ - if (node) - of_node_put(node); return 0; }