mbox series

[0/5] driver core: Prevent device_find_child() from modifying caller's match data

Message ID 20240811-const_dfc_prepare-v1-0-d67cc416b3d3@quicinc.com (mailing list archive)
Headers show
Series driver core: Prevent device_find_child() from modifying caller's match data | expand

Message

Zijun Hu Aug. 11, 2024, 12:18 a.m. UTC
For driver API:
struct device *device_find_child(struct device *dev, void *data,
		int (*match)(struct device *dev, void *data));

It does not make sense for its match function (*match)() to modify
caller's match data @*data, but there are 3 device_find_child() usages
whose match functions do such awful things within current kernel tree.

This patch series is to clean up them first to prepare to constify the API.

Previous discussion link:
https://lore.kernel.org/lkml/917359cc-a421-41dd-93f4-d28937fe2325@icloud.com

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
Zijun Hu (5):
      driver core: Add simple parameter checks for APIs device_(for_each|find)_child()
      driver core: Introduce an API constify_device_find_child_helper()
      cxl/region: Prevent device_find_child() from modifying caller's match data
      firewire: core: Prevent device_find_child() from modifying caller's match data
      net: qcom/emac: Prevent device_find_child() from modifying caller's match data

 drivers/base/core.c                             | 41 +++++++++++++++++++++++--
 drivers/cxl/core/region.c                       |  3 +-
 drivers/firewire/core-device.c                  |  5 +--
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.c |  5 +--
 include/linux/device.h                          |  7 +++++
 5 files changed, 53 insertions(+), 8 deletions(-)
---
base-commit: bfa54a793ba77ef696755b66f3ac4ed00c7d1248
change-id: 20240811-const_dfc_prepare-3ff23c6598e5

Best regards,