Browse Source

kernel: reserved_mem: add missing IORESOURCE_MEM flag on resources

This patch fixes a bug in a patch we backported.

This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.

Fixes: 9d3009f426d5 ("airoha: major backport of Airoha Ethernet driver feature support")
Link: https://github.com/openwrt/openwrt/pull/21366
(cherry picked from commit b3cc77eeadd4ddbff1b9e7605202c03499059990)
Link: https://github.com/openwrt/openwrt/pull/21390
Signed-off-by: Hauke Mehrtens <[email protected]>
Hauke Mehrtens 1 month ago
parent
commit
f575392914

+ 32 - 0
target/linux/generic/backport-6.12/212-v6.17-of-reserved_mem-Add-missing-IORESOURCE_MEM-flag-on-r.patch

@@ -0,0 +1,32 @@
+From aea70964b5a7ca491a3701f2dde6c9d05d51878d Mon Sep 17 00:00:00 2001
+From: "Rob Herring (Arm)" <[email protected]>
+Date: Wed, 20 Aug 2025 14:28:04 -0500
+Subject: of: reserved_mem: Add missing IORESOURCE_MEM flag on resources
+
+Commit f4fcfdda2fd8 ('of: reserved_mem: Add functions to parse
+"memory-region"') failed to set IORESOURCE_MEM flag on the resources.
+The result is functions such as devm_ioremap_resource_wc() will fail.
+Add the missing flag.
+
+Fixes: f4fcfdda2fd8 ('of: reserved_mem: Add functions to parse "memory-region"')
+Reported-by: Iuliana Prodan <[email protected]>
+Reported-by: Daniel Baluta <[email protected]>
+Tested-by: Iuliana Prodan <[email protected]>
+Reviewed-by: Iuliana Prodan <[email protected]>
+Reviewed-by: Saravana Kannan <[email protected]>
+Link: https://lore.kernel.org/r/[email protected]
+Signed-off-by: Rob Herring (Arm) <[email protected]>
+---
+ drivers/of/of_reserved_mem.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/of/of_reserved_mem.c
++++ b/drivers/of/of_reserved_mem.c
+@@ -725,6 +725,7 @@ int of_reserved_mem_region_to_resource(c
+ 		return -EINVAL;
+ 
+ 	resource_set_range(res, rmem->base, rmem->size);
++	res->flags = IORESOURCE_MEM;
+ 	res->name = rmem->name;
+ 	return 0;
+ }