diag: Release mutex in corner case

DIAG driver maintains a table for all registrations by remote
peripherals and user space applications. In certain cases, the
number of registrations can exceed table capacity. Thus, diag
re-allocates the table memory, to fit in all registrations.
This re-allocation stops at a threshold, even if requirement
is greater than threshold.

In such a corner case, if the requirement is greater than threshold,
then the mutex might remain locked after filling the table upto full
capacity. Adding unlocking condition to release mutex in such cases.

Change-Id: Iefd02795b531e17ff7cfe3be152e32b3e82c68fb
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
3 files changed