[FIX] Resolve compile issues with mb-gcc

The gcc port for microblaze crashes during
optimization of a pointer arithmetic introduced
in commit d8cf5dcc1827db7e6fed4748fb0cd8e31a8877e1.
This commit adds a volatile in order to prevent
an unwanted optimization.
An additional error handling is also added in this
commit.

Change-Id: Id66cb3ad71e5e72991df1fb8098ea57533a47db0