[DTV00857290][[DTV][Coverity Scanned Code Defect] 15367: Out-of-bounds write]

[Description]
Fix coverity defects under mgmt/

i. Fix "Dereference null return value" issues.
ii. Remove do-while loop style.

[Related CIDs]
CID2222649, CID2222648, CID2222647, CID2222646, CID2222645,
CID361510, CID15464

Conflicts:
	mgmt/p2p_role_fsm.c

Change-Id: I1d7f2d86cee69d2afef60c8ad585d77b59603214
CR-Id: DTV00857290
Signed-off-by: Awk Jiang <awk.jiang@mediatek.com>
Feature: misc
(cherry picked from commit b907cd87c9bba8d4a0541bb79cf6b5203f0da6bc)
3 files changed