kmod/core: error handling review fixes

Some fixes from the code review for better readability.