mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Fix boardobj allocation size
In current implementation we are allocating boardobj in nvgpu_boardobj_construct_super for all units and assigning that pointer to boardobj type, as the size differe for different units assigning the boardobj pointer to a common type will give violations. Fixing them by allocating mem a head and later call construct_super for elements initialization. NVGPU-4484 Change-Id: I9b5ed1a6d8418fec48a29eee38d55fc7d83fcfab Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2335989 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
0115c26f1b
commit
8e545ef04b
@@ -64,27 +64,33 @@ static int _therm_device_pmudata_instget(struct gk20a *g,
|
||||
}
|
||||
|
||||
static int construct_therm_device(struct gk20a *g,
|
||||
struct boardobj **ppboardobj, size_t size, void *pargs)
|
||||
struct boardobj *ppboardobj, void *pargs)
|
||||
{
|
||||
return nvgpu_boardobj_construct_super(g, ppboardobj, size, pargs);
|
||||
return pmu_boardobj_construct_super(g, ppboardobj, pargs);
|
||||
}
|
||||
|
||||
static int construct_therm_device_gpu(struct gk20a *g,
|
||||
struct boardobj **ppboardobj, size_t size, void *pargs)
|
||||
struct boardobj *ppboardobj, void *pargs)
|
||||
{
|
||||
return construct_therm_device(g, ppboardobj, size, pargs);
|
||||
return construct_therm_device(g, ppboardobj, pargs);
|
||||
}
|
||||
|
||||
static struct boardobj *therm_device_construct(struct gk20a *g,
|
||||
void *pargs)
|
||||
{
|
||||
struct boardobj *board_obj_ptr = NULL;
|
||||
struct therm_device *ptherm_device = NULL;
|
||||
int status = 0;
|
||||
|
||||
ptherm_device = nvgpu_kzalloc(g, sizeof(struct therm_device));
|
||||
if (ptherm_device == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
board_obj_ptr = (struct boardobj *)(void *)ptherm_device;
|
||||
|
||||
if (BOARDOBJ_GET_TYPE(pargs) ==
|
||||
NV_VBIOS_THERM_DEVICE_1X_ENTRY_CLASS_GPU) {
|
||||
status = construct_therm_device_gpu(g, &board_obj_ptr,
|
||||
sizeof(struct therm_device), pargs);
|
||||
status = construct_therm_device_gpu(g, board_obj_ptr, pargs);
|
||||
} else {
|
||||
nvgpu_err(g, "unsupported therm_device class - 0x%x",
|
||||
BOARDOBJ_GET_TYPE(pargs));
|
||||
|
||||
Reference in New Issue
Block a user