hal: Fix adev_open error handling

Change error handling in adev_open to correctly
set adev pointer to NULL after freeing memory and
destroy adev mutex before freeing adev memory. If
adev pointer is not set to NULL any calls made
into ahal will pass NULL checks and access freed
memory causing multiple issues such as segmentation
for locking a freed adev mutex.

Change-Id: I3cf35999d09418be3bb0c888d620eae18831a153
1 file changed