Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4713586imc; Mon, 25 Feb 2019 09:37:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IYu4R1Z7bP5sieNoMPdceG9sbN8YyZ7be7uhNQwjMjkQWIDb9F6MKCwTLoUKor+Hr1l2e5u X-Received: by 2002:a62:449b:: with SMTP id m27mr21683588pfi.79.1551116263818; Mon, 25 Feb 2019 09:37:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551116263; cv=none; d=google.com; s=arc-20160816; b=RlCsKOmslXA1ZJQuP/yInXIrPJCUaNOMzuzKR5kCG4SCbC0O85xt0jWg4bmKmvdQlW mJEHq4rUVMR4u7ZeGz7AB1M4xBMCEw+PyP7sIOUD+mIrr3prN2+akKK1Ubuq2R3y2Zhr FKYHb7Fe1kq+oRRhQ0yrLCQsfTM2bK0ELF7IEyEjJZ+mIgTeK5NXKn6PuSLNWEDKfd5e x+/X3km4vlUaTDYRYs9WF1/06GN2C3LkKKyVQen7Q4NeUDp8bkHINWXsYXoHr6QaXuSm mhiGwXUtlzvNfy64JC449Rx6vYSwlmAU2UTBlb84OOOjLlOqVV3Wqnp+dBjZzsnuI0JL Uevw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=bnK3SpwnFHTefOL1Ti4WKPtMS+nlBzklz5AMz5PXvZc=; b=R65z/Mlt7A6GaMoB5ije0hLu4jz0S05xQoynoP0Ai7Mo7ZT5HbAqsMHvr3WypmT0bg AnY/fmrqbgMPOL8QyG3grTERzzwlQFs6lDaUYg82vkDUi9TVuE/0QQtBUZApVXeScXIA G1g4oudNPcxRRwwiYNnzA7VGWBtEBPV14nETC7o8IairiUnq8xb9YEzW7F+noUzi6TDM +wVvYDvtQQ6naWycolsZsVXLjD/wi3ZdoPBiztPWzVYFk9iLTVsm97n5v1k9FaLsI7AC xbCB9HDXyw7ZFlVWLZF5s6ubXePwaDoNwWVhLNMAr3sHxVvmR67qsXtX9VX/e6whXHsF r0cQ== 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 y4si9579390pgv.520.2019.02.25.09.37.28; Mon, 25 Feb 2019 09:37:43 -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 S1728766AbfBYRfX (ORCPT + 99 others); Mon, 25 Feb 2019 12:35:23 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:42760 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbfBYRfX (ORCPT ); Mon, 25 Feb 2019 12:35:23 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id D38E014EE12A7; Mon, 25 Feb 2019 09:35:22 -0800 (PST) Date: Mon, 25 Feb 2019 09:35:20 -0800 (PST) Message-Id: <20190225.093520.1888476051243130091.davem@davemloft.net> To: wen.yang99@zte.com.cn Cc: andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn Subject: Re: [PATCH v2] net: dsa: fix a leaked reference by adding missing of_node_put From: David Miller In-Reply-To: <1551079339-30270-1-git-send-email-wen.yang99@zte.com.cn> References: <1551079339-30270-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 25 Feb 2019 09:35:23 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wen Yang Date: Mon, 25 Feb 2019 15:22:19 +0800 > The call to of_parse_phandle returns a node pointer with refcount > incremented thus it must be explicitly decremented after the last > usage. > > Detected by coccinelle with the following warnings: > ./net/dsa/port.c:294:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 284, but without a corresponding object release within this function. > ./net/dsa/dsa2.c:627:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 618, but without a corresponding object release within this function. > ./net/dsa/dsa2.c:630:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 618, but without a corresponding object release within this function. > ./net/dsa/dsa2.c:636:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 618, but without a corresponding object release within this function. > ./net/dsa/dsa2.c:639:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 618, but without a corresponding object release within this function. > > Signed-off-by: Wen Yang > Reviewed-by: Vivien Didelot > Reviewed-by: "David S. Miller" Applied.