1 Star 0 Fork 75

chenjiji09/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0278-raw-ifpga-base-fix-init-with-multi-process.patch 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
chenjiji09 提交于 2023-04-27 15:25 . fix empty devargs parsing
From 08ad2bc6e7fd4bc11b25011dbae48268828d372f Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Mon, 6 Feb 2023 10:53:11 +0000
Subject: raw/ifpga/base: fix init with multi-process
[ upstream commit e6a2804b77c5fbfd97d0fe05ec7f959a0404a380 ]
The MAP_FAILED should be used to determine whether the mapping is
successful.
Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
---
drivers/raw/ifpga/base/opae_hw_api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/raw/ifpga/base/opae_hw_api.c b/drivers/raw/ifpga/base/opae_hw_api.c
index 11c9887c7f..45efe70473 100644
--- a/drivers/raw/ifpga/base/opae_hw_api.c
+++ b/drivers/raw/ifpga/base/opae_hw_api.c
@@ -380,7 +380,7 @@ static pthread_mutex_t *opae_adapter_mutex_open(struct opae_adapter *adapter)
PROT_READ | PROT_WRITE, MAP_SHARED,
shm_id, 0);
adapter->lock = (pthread_mutex_t *)ptr;
- if (ptr) {
+ if (ptr != MAP_FAILED) {
dev_info(NULL,
"shared memory %s address is %p\n",
shm_name, ptr);
@@ -499,7 +499,7 @@ static void *opae_adapter_shm_alloc(struct opae_adapter *adapter)
adapter->shm.size = size;
adapter->shm.ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, shm_id, 0);
- if (adapter->shm.ptr) {
+ if (adapter->shm.ptr != MAP_FAILED) {
dev_info(NULL,
"shared memory %s address is %p\n",
shm_name, adapter->shm.ptr);
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenjiji09/dpdk.git
git@gitee.com:chenjiji09/dpdk.git
chenjiji09
dpdk
dpdk
master

搜索帮助