nouveau/nvc0: silence maybe-uninitialized warning
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 6 Jul 2020 03:20:04 +0000 (13:20 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 8 Jul 2020 03:04:03 +0000 (03:04 +0000)
commit7ccf2580638c690bb2661781a06385a6f96e6217
treecb03734643d6ff3835374552b06681f1fdc5df62
parent6bec54dd3e3fa5379c08cab38fd6ff335c941adc
nouveau/nvc0: silence maybe-uninitialized warning

gcc is not smart enough to see that

   enum pipe_format dst_fmt;
   ...

   switch (data_size) {
   case 16:
      dst_fmt = PIPE_FORMAT_R32G32B32A32_UINT;
      ...
      break;
   case 12:
      /* RGB32 is not a valid RT format. This will be handled by the pushbuf
       * uploader.
       */
      break;
   case 8:
      dst_fmt = PIPE_FORMAT_R32G32_UINT;
      ...
      break;
   case 4:
      dst_fmt = PIPE_FORMAT_R32_UINT;
      ...
      break;
   case 2:
      dst_fmt = PIPE_FORMAT_R16_UINT;
      ...
      break;
   case 1:
      dst_fmt = PIPE_FORMAT_R8_UINT;
      break;
   default:
      assert(!"Unsupported element size");
      return;
   }

   ...

   if (data_size == 12) {
      ...
      return;
   }

Does not result in dst_fmt being uninitialized when it is used so
lets just initialise it to silence the warning.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5766>
src/gallium/drivers/nouveau/nvc0/nvc0_surface.c