[WCNCR00166525] misc: fix coverity issues

[Description]
Fix CID
2496642 Dereference null return value
4065171 Calling risky function
4077560 Array compared against 0

Change-Id: I9eb3036e682aa66ab8eb2ee30184f5eae323419d
CR-Id: WCNCR00166525
Feature: misc
Signed-off-by: guo-jie.wang <guo-jie.wang@mediatek.com>
Reviewed-on: http://gerrit.mediatek.inc:8080/1228393
CheckPatch: Check Patch <srv_checkpatch@mediatek.com>
Reviewed-by: Sarick Jiang <sarick.jiang@mediatek.com>
Reviewed-by: George Kuo <george.kuo@mediatek.com>
Build: srv_neptune_adm <srv_neptune_adm@mediatek.com>
3 files changed