img: Remove dead code and compact a little

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>