diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c index 6b3c68dc769d..5f4acd4510f8 100644 --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c @@ -1589,9 +1589,10 @@ _DebugfsCleanup(IN gckGALDEVICE Device) } #else /* TODO. */ - struct device *dev = (struct device *)Device->devices[0]->dev; - - sysfs_remove_groups(&dev->kobj, Info_groups); + if (Device && Device->devices[0] != gcvNULL) { + struct device *dev = (struct device *)Device->devices[0]->dev; + sysfs_remove_groups(&dev->kobj, Info_groups); + } #endif } @@ -2824,6 +2825,7 @@ gckGALDEVICE_Destroy(gckGALDEVICE gal_device) gcmkVERIFY_OK(gckDEVICE_Destroy(device->os, device)); + gal_device->devices[devIndex] = gcvNULL; device = gcvNULL; }