未验证 提交 dba139eb 编写于 作者: O openharmony_ci 提交者: Gitee

!49 【同步】- 内存分配后未校验返回值 到 monthly_20221018 分支

Merge pull request !49 from zhushengle/cherry-pick-1669348770
......@@ -359,23 +359,31 @@ static struct file_operations_vfs g_hieventFops = {
.poll = HieventPoll, /* poll */
};
static void HieventDeviceInit(void)
static int HieventDeviceInit(void)
{
g_hieventDev.buffer = LOS_MemAlloc((VOID *)OS_SYS_MEM_ADDR,
HIEVENT_LOG_BUFFER);
if (g_hieventDev.buffer == NULL) {
return -ENOMEM;
}
init_waitqueue_head(&g_hieventDev.wq);
LOS_MuxInit(&g_hieventDev.mtx, NULL);
(void)LOS_MuxInit(&g_hieventDev.mtx, NULL);
g_hieventDev.writeOffset = 0;
g_hieventDev.headOffset = 0;
g_hieventDev.size = 0;
g_hieventDev.count = 0;
return 0;
}
int HieventInit(void)
{
HieventDeviceInit();
int ret = HieventDeviceInit();
if (ret != 0) {
return ret;
}
register_driver("/dev/hwlog_exception", &g_hieventFops,
DRIVER_MODE, &g_hieventDev);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册