st-hal: Fix potential NULL dereference issues

This change addresses several issues related to potential
dereferencing of NULL pointers.

Change-Id: Ieeae8567da9d2b633f0c7cc06b8eb9f902326be4
2 files changed