u-boot/drivers/core
Eugen Hristev 15a2865515 dm: core: of_access: fix return value in of_property_match_string
of_property_match_string calls of_find_property to search for the
string property.
If the device node does not exist, of_find_property returns NULL, and
of_property_match_string returns -EINVAL, which is correct.
However, if the device node exists, but the property is not found,
of_find_property still returns NULL, but it will place -FDT_ERR_NOTFOUND
in the *lenp variable.
of_property_match_string does not use the lenp parameter, thus this error
case is being lost, and treated as if the node is NULL, and returns
-EINVAL, which is incorrect.

The callers of of_property_match_string treat the error differently if
the return value is -EINVAL or -ENOENT, e.g. in dwc3 driver:

	ret = generic_phy_get_by_name(dev, "usb3-phy", &phy);
	if (!ret) {
		ret = generic_phy_init(&phy);
		if (ret)
			return ret;
	} else if (ret != -ENOENT && ret != -ENODATA) {
		debug("could not get phy (err %d)\n", ret);
		return ret;
	} else {
		phy.dev = NULL;
	}

So the caller drivers will just consider the property missing if -ENOENT
is returned, versus the case of -EINVAL, which means something else.

To fix this situation, changed the code to call the of_find_property
with the right third argument to catch this error code and treat it
accordingly.

Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
2023-07-20 14:10:57 -06:00
..
acpi.c common: Drop display_options.h from common header 2022-08-10 13:46:55 -04:00
device-remove.c dm: core: Use device_foreach_child where possible 2022-06-28 03:09:51 +01:00
device.c timer: Tidy up use of notrace 2023-02-11 12:22:34 -05:00
devres.c dm: core: Use device_foreach_child where possible 2022-06-28 03:09:51 +01:00
dump.c dm: core: Use full printf() format when possible 2023-01-26 10:47:45 -07:00
fdtaddr.c core: fdtaddr: use map_sysmem() as cast for the return (part 2) 2023-05-15 17:14:46 -04:00
Kconfig acpi: Create a new Kconfig for ACPI 2023-05-11 10:25:29 +08:00
lists.c dm: core: Fix iteration over driver_info records 2022-12-02 08:39:00 -05:00
Makefile vpl: Add Kconfig options for VPL 2022-05-02 09:58:13 -04:00
of_access.c dm: core: of_access: fix return value in of_property_match_string 2023-07-20 14:10:57 -06:00
of_addr.c drivers/core/of_addr.c: Fix spelling of "shouldn't". 2022-01-13 07:57:50 -05:00
of_extra.c net: introduce a helper to determine whether to use in-band autoneg 2021-11-23 09:57:55 +02:00
ofnode.c fdt: Allow more general use of livetree 2023-07-14 12:54:51 -04:00
read.c core: read: add dev_read_addr_index_ptr function 2023-05-06 17:28:18 +08:00
read_extra.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
regmap.c core: remap: fix regmap_init_mem_plat() reg size handeling 2023-05-06 17:28:18 +08:00
root.c dm: Emit the arch_cpu_init_dm() even only before relocation 2023-05-11 10:25:29 +08:00
simple-bus.c treewide: Use OF_REAL instead of !OF_PLATDATA 2021-09-25 09:46:15 -06:00
simple-pm-bus.c simple-pm-bus: Use -ENOSYS for checking missing system call 2021-04-06 16:33:19 +12:00
syscon-uclass.c core: remap: fix regmap_init_mem_plat() reg size handeling 2023-05-06 17:28:18 +08:00
tag.c dm: core: Add a command to show driver model statistics 2022-06-28 03:09:52 +01:00
uclass.c dm: core: introduce uclass_get_device_by_of_path() 2023-04-28 11:48:59 -06:00
util.c treewide: Use OF_REAL instead of !OF_PLATDATA 2021-09-25 09:46:15 -06:00