flash: add error handling to get_flash_by_addr/name