lib/efi: Cleanup read/write routines