Skip to content

Conversation

@rmsyn
Copy link

@rmsyn rmsyn commented Jan 11, 2024

Removes calls to unwrap and explicit panic macro calls. This helps to avoid runtime panics in the library, and bubbles-up any errors that occur.

The top level DeviceTree::from_dts_bytes is left as an infallible function, and any errors are printed with a println call. Maybe we want to make this fallible as well?

These changes are isolated to the DTS parser, and do not fix panics in the DTB parser.

rmsyn added 6 commits January 11, 2024 01:45
Removes calls to `unwrap` on `Result` and `Option` types to avoid
runtime panics. Continues to the next loop iteration on failure
conditions.

Signed-off-by: rmsyn <[email protected]>
Removes calls to `unwrap` and explicit `panic`s to avoid runtime panics.

Signed-off-by: rmsyn <[email protected]>
Removes explicit calls to `unwrap`, and changes the return type of
`parse_node` to a `Result`. This allows for bubbling up errors, and the
future introduction of a library-wide `Error` type.

Minor clean-up of some `println` statements.

Signed-off-by: rmsyn <[email protected]>
Removes calls to `unwrap` and explicit `panic`s from `parse_node_value`
to avoid runtime panics.

Changes the return type to `Result` to make the function fallible, and
allow for the future introduction of a library `Error` type.

Signed-off-by: rmsyn <[email protected]>
Removes `unwrap` calls and explicit `panic`s to avoid runtime panics.

Changes the return type to `Result` to make `parse_tree` fallible, and
allow for the future introduction of a library `Error` type.

Signed-off-by: rmsyn <[email protected]>
Changes the return type to `Result` to make `parse` fallible, and allow
for the future introduction of a library `Error` type.

Signed-off-by: rmsyn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant