Skip to contentSkip to conversation

firmware: arm_sdei: fix SDEI DT probing

PATCH New James Morse 1 participant 3 messages Dec 21, 2018 Software delegated exception interface (sdei)

lore
Share & tools
lore

James Morse

author maintainer
#0 lore raw

cover firmware: arm_sdei: fix SDEI DT probing

Hi guys,

A patch from Nicolas to fix some cargo-culted reference-miscounting highlighted that, embarrassingly, the SDEI DT probing hasn't been tested properly since it was merged. commit 3aa0582fdb82 ("of: platform:
populate /firmware/ node from of_platform_default_populate_init()") came in at the same time and changed the core-code to generate the platform devices, meaning the driver's attempt fails, and it bails out.

Fix these by removing the unbalanced-refcount, and not attempting to re-create the platform device. As this is in the never-worked territory, I don't think the fixes tags are necessary. If someone disagrees, its:

Fixes ad6eb31ef903 ("firmware: arm_sdei: Add driver for Software Delegated Exceptions")

Thanks,

James Morse (1):
firmware: arm_sdei: Fix DT platform device creation

Nicolas Saenz Julienne (1):
firmware: arm_sdei: fix wrong of_node_put() in init function

 drivers/firmware/arm_sdei.c | 6 ------
 1 file changed, 6 deletions(-)
Signature · 7 lines
2.19.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#1 lore raw

PATCH 1/2 firmware: arm_sdei: fix wrong of_node_put() in init function

From: Nicolas Saenz Julienne <[email protected]>

After finding a "firmware" dt node arm_sdei tries to match it's compatible string with it. To do so it's calling of_find_matching_node() which already takes care of decreasing the refcount on the "firmware" node. We are then incorrectly decreasing the refcount on that node again.

This patch removes the unwarranted call to of_node_put().

---
 drivers/firmware/arm_sdei.c | 1 -
 1 file changed, 1 deletion(-)
drivers/firmware/arm_sdei.c +0 -1
index 1ea71640fdc2..dffb47c6b480 100644
@@ -1017,7 +1017,6 @@ static bool __init sdei_present_dt(void)
 		return false;
 
 	np = of_find_matching_node(fw_np, sdei_of_match);
-	of_node_put(fw_np);
 	if (!np)
 		return false;
 
Signature · 7 lines
2.19.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#2 lore raw

PATCH 2/2 firmware: arm_sdei: Fix DT platform device creation

In reply to James Morse

It turns out the dt-probing part of this wasn't tested properly after it was merged. commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") changed the core-code to generate the platform devices, meaning the driver's attempt fails, and it bails out.

Fix this by removing the manual platform-device creation for DT systems, core code has always done this for us.

CC Nicolas Saenz Julienne <[email protected]>

---
Why is this useful on DT systems? The spec has parts to bind interrupts as NMI, and signal CPUs with a well known event number. As probing has evidently never worked with DT I don't think it needs a fix/stable tag.

---
 drivers/firmware/arm_sdei.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/firmware/arm_sdei.c +0 -5
index dffb47c6b480..c64c7da73829 100644
@@ -1009,7 +1009,6 @@ static struct platform_driver sdei_driver = {
 
 static bool __init sdei_present_dt(void)
 {
-	struct platform_device *pdev;
 	struct device_node *np, *fw_np;
 
 	fw_np = of_find_node_by_name(NULL, "firmware");
@@ -1019,11 +1018,7 @@ static bool __init sdei_present_dt(void)
 	np = of_find_matching_node(fw_np, sdei_of_match);
 	if (!np)
 		return false;
-
-	pdev = of_platform_device_create(np, sdei_driver.driver.name, NULL);
 	of_node_put(np);
-	if (!pdev)
-		return false;
 
 	return true;
 }
Signature · 7 lines
2.19.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel