Skip to contentSkip to conversation

jailhouse: Hold reference returned from of_find_xxx API

PATCH Juergen Gross via Virtualization 3 participants 3 messages Sep 16, 2022 – Sep 19, 2022 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Juergen Gross via Virtualization

author Reviewed-by Juergen Gross
#1 lore raw
In reply to a message not in the archive
Quoted 8 lines · Liang He

In jailhouse_paravirt(), we should hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done.

Fixes 63338a38db95 ("jailhouse: Provide detection for non-x86 systems")

Juergen

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by
#2 lore raw
In reply to a message not in the archive

[ Adding author and reviewers of commit 63338a38db95 again ]

Quoted 8 lines · Liang He

In jailhouse_paravirt(), we should hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done.

Fixes 63338a38db95 ("jailhouse: Provide detection for non-x86 systems")
Quoted 15 lines

---

v2: use proper return type not the 'np' pointer

 include/linux/hypervisor.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/hypervisor.h +0 -0
index 9efbc54e35e5..f11eec57ea63 100644
@@ -27,7 +27,11 @@ static inline void hypervisor_pin_vcpu(int cpu)
 
 static inline bool jailhouse_paravirt(void)

include/linux/hypervisor.h static inline void hypervisor_pin_vcpu(int cpu) · line 37

Quoted 10 lines
include/linux/hypervisor.h +5 -1
 {
-	return of_find_compatible_node(NULL, NULL, "jailhouse,cell");
+	struct device_node *np = of_find_compatible_node(NULL, NULL, "jailhouse,cell");
+
+	of_node_put(np);
+
+	return np ? true : false;
 }
 
 #endif /* !CONFIG_X86 */

Regards,
Srivatsa
VMware Photon OS

#3 lore raw
Quoted 7 lines · Srivatsa S. Bhat

[ Adding author and reviewers of commit 63338a38db95 again ]

Quoted 4 lines · Liang He

In jailhouse_paravirt(), we should hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done.

Quoted 6 lines
Quoted 4 lines
Fixes 63338a38db95 ("jailhouse: Provide detection for non-x86 systems")

The message to which you are responding didn't make it to the mailing list, so it's unlikely that anybody will pick it up. See the archive:
https://lore.kernel.org/all/[email protected]/

Maybe it was a multipart message or was HTML, which the mailing lists
reject: http://vger.kernel.org/majordomo-info.html

Bjorn
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization