realtek: pcs: use devm_kzalloc()

Just for safety. Use device managed operation so the
memory is automatically reclaimed when the parent PCS
controller is removed.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23391
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Markus Stockhausen
2026-05-15 21:53:29 +02:00
committed by Robert Marko
parent c83c74a482
commit 42cf34d3f8
@@ -4110,7 +4110,7 @@ struct phylink_pcs *rtpcs_create(struct device *dev, struct device_node *np, int
if (sds->num_of_links >= RTPCS_MAX_LINKS_PER_SDS)
return ERR_PTR(-ERANGE);
link = kzalloc(sizeof(*link), GFP_KERNEL);
link = devm_kzalloc(ctrl->dev, sizeof(*link), GFP_KERNEL);
if (!link) {
put_device(&pdev->dev);
return ERR_PTR(-ENOMEM);