Looking through a lot of the examples there is a pattern like the following:
ret = gpio_pin_configure_dt( &led0, GPIO_OUTPUT_ACTIVE ); if ( ret < 0 ) { return 1; }
Where you capture the success of the function, and on a failure return 1. My main question is what is the ultimate purpose of doing this and what is considered best practice when using this pattern? In the examples it results in the main loop just returning a 1. What happens then? Does the microcontroller throw an error or fault? Or does it just try to restart the main loop? Does Zephyr have some sort of handling of the error if the main loop returns 1? It is kind of unclear what the purpose of these if() return statements are beyond "You should check that config/reading/etc worked"
If I am using functions within my application am I expected to raise the error up to the main loop? Is it used for debugging?
Mostly just looking to gain insight on the programming pattern and its purpose and uses when developing in the Zephyr ecosystem which I am fairly new to.