[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230807134714.2048214-1-xiangyang@huaweicloud.com>
Date: Mon, 7 Aug 2023 13:47:14 +0000
From: Xiang Yang <xiangyang@...weicloud.com>
To: clement.leger@...tlin.com,
hkallweit1@...il.com,
linux@...linux.org.uk,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
olteanv@...il.com,
f.fainelli@...il.com
Cc: linux-renesas-soc@...r.kernel.org,
netdev@...r.kernel.org,
xiangyang3@...wei.com
Subject: [PATCH -next] net: pcs: Add missing put_device call in miic_create
From: Xiang Yang <xiangyang3@...wei.com>
The reference of pdev->dev is taken by of_find_device_by_node, so
it should be released when error out.
Fixes: 7dc54d3b8d91 ("net: pcs: add Renesas MII converter driver")
Signed-off-by: Xiang Yang <xiangyang3@...wei.com>
---
drivers/net/pcs/pcs-rzn1-miic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c
index e5d642c67a2c..d097f123635a 100644
--- a/drivers/net/pcs/pcs-rzn1-miic.c
+++ b/drivers/net/pcs/pcs-rzn1-miic.c
@@ -318,8 +318,10 @@ struct phylink_pcs *miic_create(struct device *dev, struct device_node *np)
return ERR_PTR(-EPROBE_DEFER);
miic_port = kzalloc(sizeof(*miic_port), GFP_KERNEL);
- if (!miic_port)
+ if (!miic_port) {
+ put_device(&pdev->dev);
return ERR_PTR(-ENOMEM);
+ }
miic = platform_get_drvdata(pdev);
device_link_add(dev, miic->dev, DL_FLAG_AUTOREMOVE_CONSUMER);
--
2.34.1
Powered by blists - more mailing lists