Commit 4bdcef27c2cd996755f3339460f9b0f7f4c7d1d9

Authored by Xianzhong
1 parent 1d540db76d

MGS-4652 [#imx-1379] fix coverity dereference issue

CID: 5781508
device pointer should not be used before null check

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 17942905375a282ed9896c3cc778a246c321f5f0)

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c
... ... @@ -510,9 +510,14 @@
510 510 {
511 511 gcsINFO_NODE *node = m->private;
512 512 gckGALDEVICE device = node->device;
513   - gcsPLATFORM * platform = device->platform;
  513 + gcsPLATFORM * platform = gcvNULL;
514 514  
515 515 if (!device)
  516 + return -ENXIO;
  517 +
  518 + platform = device->platform;
  519 +
  520 + if (!platform)
516 521 return -ENXIO;
517 522  
518 523 seq_printf(m, "%s built at %s\n", gcvVERSION_STRING, HOST);