[PATCH v2 1/3] of: reserved_mem: Support multiple 'reg' entries for memory-region

Krzysztof Kozlowski krzk at kernel.org
Sat Nov 22 03:30:51 PST 2025


On Fri, Nov 21, 2025 at 04:42:35PM +0100, Gregory CLEMENT wrote:
> + * This function allows drivers to lookup a node's 'memory-region' property
> + * entries by index and fill an array of struct resource pointers for the entries.
> + *
> + * Returns the number of resources filled in @res on success.
> + * Returns -ENODEV if 'memory-region' is missing or unavailable,
> + * -EINVAL for any other error.
> + */
> +int of_reserved_mem_region_to_resource_array(struct device *dev, const struct device_node *np,
> +					     unsigned int idx, struct resource **res)
> +{
> +	struct reserved_mem *rmem[MAX_RESERVED_REGIONS];
> +	int count, i;
> +	struct resource *r;
> +
> +	if (!np)
> +		return -EINVAL;
> +
> +	struct device_node __free(device_node) *target = of_parse_phandle(np, "memory-region", idx);

Odd cleanup placement. Please read cleanup.h. Also please run checkpatch
because it told you this - marked it as ERROR.

Best regards,
Krzysztof




More information about the linux-arm-kernel mailing list