[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240811-const_dfc_prepare-v1-5-d67cc416b3d3@quicinc.com>
Date: Sun, 11 Aug 2024 08:18:11 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Takashi Sakamoto <o-takashi@...amocchi.jp>, Timur Tabi <timur@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org,
linux-cxl@...r.kernel.org, linux1394-devel@...ts.sourceforge.net,
netdev@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH 5/5] net: qcom/emac: Prevent device_find_child() from
modifying caller's match data
From: Zijun Hu <quic_zijuhu@...cinc.com>
It does not make sense for emac_sgmii_acpi_match() as device_find_child()'s
match function to modify caller's match data, fixed by using
constify_device_find_child_helper() instead of device_find_child().
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
index e4bc18009d08..e53065756a1d 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
@@ -358,8 +358,9 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
if (has_acpi_companion(&pdev->dev)) {
struct device *dev;
- dev = device_find_child(&pdev->dev, &phy->sgmii_ops,
- emac_sgmii_acpi_match);
+ dev = constify_device_find_child_helper(&pdev->dev,
+ &phy->sgmii_ops,
+ emac_sgmii_acpi_match);
if (!dev) {
dev_warn(&pdev->dev, "cannot find internal phy node\n");
--
2.34.1
Powered by blists - more mailing lists