nv50: check return value of nouveau_object_new()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 14 Dec 2015 16:51:59 +0000 (17:51 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 14 Dec 2015 18:08:39 +0000 (19:08 +0100)
When ret == 0, obj is not NULL. Spotted by Coverity.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/nv50/nv84_video.c

index 7a4670f663db027ed8a00189295efd4844423d37..88655dbfae5c93528e6b0dbbf2a6dbc717dca1f8 100644 (file)
@@ -756,8 +756,8 @@ firmware_present(struct pipe_screen *pscreen, enum pipe_video_format codec)
    int present, ret;
 
    if (!FIRMWARE_PRESENT(checked, VP_KERN)) {
-      nouveau_object_new(screen->channel, 0, 0x7476, NULL, 0, &obj);
-      if (obj)
+      ret = nouveau_object_new(screen->channel, 0, 0x7476, NULL, 0, &obj);
+      if (!ret)
          screen->firmware_info.profiles_present |= FIRMWARE_VP_KERN;
       nouveau_object_del(&obj);
       screen->firmware_info.profiles_checked |= FIRMWARE_VP_KERN;
@@ -765,8 +765,8 @@ firmware_present(struct pipe_screen *pscreen, enum pipe_video_format codec)
 
    if (codec == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
       if (!FIRMWARE_PRESENT(checked, BSP_KERN)) {
-         nouveau_object_new(screen->channel, 0, 0x74b0, NULL, 0, &obj);
-         if (obj)
+         ret = nouveau_object_new(screen->channel, 0, 0x74b0, NULL, 0, &obj);
+         if (!ret)
             screen->firmware_info.profiles_present |= FIRMWARE_BSP_KERN;
          nouveau_object_del(&obj);
          screen->firmware_info.profiles_checked |= FIRMWARE_BSP_KERN;