|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN][PATCH v5 02/17] common/device_tree: change __unflatten_device_tree()
Hi, On 14/04/2023 18:51, Vikram Garhwal wrote: On 4/13/23 3:03 AM, Julien Grall wrote:Looks like i misunderstood v4 comments. Will change it to propagate an error in case of failure here to the handle_add_overlay_nodes() caller and that will further forward to error to toolstack.Hi, On 11/04/2023 20:16, Vikram Garhwal wrote:Following changes are done to __unflatten_device_tree(): 1. __unflatten_device_tree() is renamed to unflatten_device_tree(). 2. Remove static function type.3. Add handling of memory allocation. This will be useful in dynamic node programming when we unflatten the dt during runtime memory allocationcan fail. Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx> --- xen/common/device_tree.c | 10 ++++++---- xen/include/xen/device_tree.h | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index aed38ff63c..bf847b2584 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c@@ -2047,7 +2047,7 @@ static unsigned long unflatten_dt_node(const void *fdt,} /** - * __unflatten_device_tree - create tree of device_nodes from flat blob + * unflatten_device_tree - create tree of device_nodes from flat blob * * unflattens a device-tree, creating the * tree of struct device_node. It also fills the "name" and "type"@@ -2056,8 +2056,7 @@ static unsigned long unflatten_dt_node(const void *fdt,* @fdt: The fdt to expand * @mynodes: The device_node tree created by the call */ -static void __unflatten_device_tree(const void *fdt, - struct dt_device_node **mynodes)+void unflatten_device_tree(const void *fdt, struct dt_device_node **mynodes) I agree that in theory fdt_overlay_apply() will catch invalid device-tree. However, neither of the functions are exempts of bugs and there is no code shared between the two (they are not even coming from the same project). So we could end up in a situation where fdt_overlay_apply() works but not unflatten_device_tree(). Therefore, I would rather prefer if the latter function properly handle any errors. Note that unflatten_dt_node() already have check the validity of the DT and will return. We just need to make sure they are treated as error rather than been ignored. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |