Really, the of_node_put() is connected to the loop and not the function so the original code is the right way to do it. Otherwise if we added more error handling to the function then normal kernel error handling wouldn't work naturally. regards, dan carpenter