Clean up image format probing code

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>