From patchwork Wed Aug 28 03:23:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13780428 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C264D14F9D5; Wed, 28 Aug 2024 03:16:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724814966; cv=none; b=awpvKBhL9jKWAWpjc9BEiECtXXg18qx+DP6Ep0f+4SUfggVmU1Ejwbh+zV+5cTyvAwfyZ47PGIRBKeVbrH2TUKeO1h2Wqf+dBvqNKJt4Fxo8CR6D4Yile1Gwdc9DUjR8P19/Bt+gKdylmwYzT2cepkChveO2UGhqC3RKl1BQ6AM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724814966; c=relaxed/simple; bh=AioIBmYTGNdkuJwkJn0J82b60E6gL5PhPcnL7o4z2wo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DAbfYkROaT4xmZVyBiKOSi6+aDmknBEvuau5tjOUQmY0XzJf6tOLQqOkCVMzz7IH1kE7Nn7jve/Q315zoVOJx4gRNIov1GoZFibiPx6WY6PCJKGNW0ATfNH14QLEnrMrON1h43kSU+H4q7g7L3TszQ0e1qFzfY4mjW9Ubb/ohJQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WtqKT1bcRzyQVR; Wed, 28 Aug 2024 11:15:09 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 40054140118; Wed, 28 Aug 2024 11:15:57 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 28 Aug 2024 11:15:56 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v2 05/13] net: phy: Fix missing of_node_put() for leds Date: Wed, 28 Aug 2024 11:23:35 +0800 Message-ID: <20240828032343.1218749-6-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828032343.1218749-1-ruanjinjie@huawei.com> References: <20240828032343.1218749-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemh500013.china.huawei.com (7.202.181.146) X-Patchwork-Delegate: kuba@kernel.org The call of of_get_child_by_name() will cause refcount incremented for leds, if it succeeds, it should call of_node_put() to decrease it, fix it. Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs") Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v2: - Split into 2 patches. - Use of_node_put() rather than __free() to fix it. --- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8f5314c1fecc..243dae686992 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3424,11 +3424,13 @@ static int of_phy_leds(struct phy_device *phydev) err = of_phy_led(phydev, led); if (err) { of_node_put(led); + of_node_put(leds); phy_leds_unregister(phydev); return err; } } + of_node_put(leds); return 0; }