Skip to content

Commit

Permalink
Fix crash issue on multiple-GPU system
Browse files Browse the repository at this point in the history
Fix: intel#1795, intel#1789
Signed-off-by: Jay Yang <[email protected]>
  • Loading branch information
MicroYY committed May 30, 2024
1 parent a0391f7 commit db1898d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,14 @@ void* MmdDevice::CreateFactory(
device->Initialize(osInterface, mhwInterfaces);
if (device->m_mmdDevice == nullptr)
{
MMD_FAILURE();
if (mhwInterfaces != nullptr)
{
mhwInterfaces->Destroy();
}
// no need to delete osinterface becauses it's already deleted.
MOS_Delete(mhwInterfaces);
MOS_Delete(device);
return nullptr;
}

void *mmdDevice = device->m_mmdDevice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,33 +277,24 @@ MOS_STATUS MmdDeviceXe_Hpm::Initialize(
PMOS_INTERFACE osInterface,
MhwInterfaces *mhwInterfaces)
{
#define MMD_FAILURE() \
{ \
if (device != nullptr) \
{ \
MOS_Delete(device); \
} \
return MOS_STATUS_NO_SPACE; \
}
MHW_FUNCTION_ENTER;

Mmd *device = nullptr;

if (mhwInterfaces->m_miInterface == nullptr)
{
MMD_FAILURE();
return MOS_STATUS_NULL_POINTER;
}

if (mhwInterfaces->m_veboxInterface == nullptr)
{
MMD_FAILURE();
return MOS_STATUS_NULL_POINTER;
}

Mmd *device = nullptr;
device = MOS_New(Mmd);

if (device == nullptr)
{
MMD_FAILURE();
return MOS_STATUS_NO_SPACE;
}

if (device->Initialize(
Expand All @@ -317,7 +308,8 @@ MOS_STATUS MmdDeviceXe_Hpm::Initialize(
mhwInterfaces->m_cpInterface = nullptr;
mhwInterfaces->m_miInterface = nullptr;
mhwInterfaces->m_veboxInterface = nullptr;
MMD_FAILURE();
MOS_Delete(device);
return MOS_STATUS_UNKNOWN;
}

m_mmdDevice = device;
Expand Down
4 changes: 2 additions & 2 deletions media_softlet/linux/common/os/i915/mos_bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5642,7 +5642,7 @@ static int mos_get_dev_id_i915(int fd, uint32_t *device_id)
*device_id = retValue;
}

return 0;
return -ENODEV;
}

int mos_get_device_id(int fd, uint32_t *deviceId)
Expand All @@ -5659,5 +5659,5 @@ int mos_get_device_id(int fd, uint32_t *deviceId)
return mos_get_dev_id_xe(fd, deviceId);
}
#endif
return -ENODEV;
return ENODEV;
}
4 changes: 2 additions & 2 deletions media_softlet/linux/common/os/i915_production/mos_bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5606,7 +5606,7 @@ static int mos_get_dev_id_i915(int fd, uint32_t *device_id)
*device_id = retValue;
}

return 0;
return -ENODEV;
}

int mos_get_device_id(int fd, uint32_t *deviceId)
Expand All @@ -5623,5 +5623,5 @@ int mos_get_device_id(int fd, uint32_t *deviceId)
return mos_get_dev_id_xe(fd, deviceId);
}
#endif
return -ENODEV;
return 0;
}

0 comments on commit db1898d

Please sign in to comment.