Move the call before the wakeup and also check its return code. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>