Fix build with -Werror

The original code causes a compiler warning about dereferencing
a type-punned pointer on gcc 4.7, causing the build with -Werror
to fail.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>