Skip to contentSkip to conversation

drm/nouveau/i2c: port to subdev interfaces

DISCUSSION Dan Carpenter 1 participant 1 message Feb 13, 2014

lore
Share & tools
lore
#0 lore raw

Hello Ben Skeggs,

The patch 4196faa86232: "drm/nouveau/i2c: port to subdev interfaces" from Jul 10, 2012, leads to the following static checker warning:

	drivers/gpu/drm/nouveau/core/engine/disp/vga.c:42 nv_rdport()
	warn: we tested 'port == 962' before and it was 'false'

drivers/gpu/drm/nouveau/core/engine/disp/vga.c

    30  nv_rdport(void *obj, int head, u16 port)
    31  {
    32          struct nouveau_device *device = nv_device(obj);
    33  
    34          if (device->card_type >= NV_50)
    35                  return nv_rd08(obj, 0x601000 + port);
    36  
    37          if (port == 0x03c0 || port == 0x03c1 || /* AR */
    38              port == 0x03c2 || port == 0x03da || /* INP0 */
                            ^^^^^^
    39              port == 0x03d4 || port == 0x03d5)   /* CR */
    40                  return nv_rd08(obj, 0x601000 + (head * 0x2000) + port);
    41  
    42          if (port == 0x03c2 || port == 0x03cc || /* MISC */
                            ^^^^^^

This can never be true because we returned already.

    43              port == 0x03c4 || port == 0x03c5 || /* SR */
    44              port == 0x03ce || port == 0x03cf) { /* GR */
    45                  if (device->card_type < NV_40)
    46                          head = 0; /* CR44 selects head */
    47                  return nv_rd08(obj, 0x0c0000 + (head * 0x2000) + port);
    48          }
    49  
    50          nv_error(obj, "unknown vga port 0x%04x\n", port);
    51          return 0x00;
    52  }
    53  
    54  void
    55  nv_wrport(void *obj, int head, u16 port, u8 data)
    56  {
    57          struct nouveau_device *device = nv_device(obj);
    58  
    59          if (device->card_type >= NV_50)
    60                  nv_wr08(obj, 0x601000 + port, data);
    61          else
    62          if (port == 0x03c0 || port == 0x03c1 || /* AR */
    63              port == 0x03c2 || port == 0x03da || /* INP0 */
                            ^^^^^^
    64              port == 0x03d4 || port == 0x03d5)   /* CR */
    65                  nv_wr08(obj, 0x601000 + (head * 0x2000) + port, data);
    66          else
    67          if (port == 0x03c2 || port == 0x03cc || /* MISC */
                            ^^^^^^

Same issue.

    68              port == 0x03c4 || port == 0x03c5 || /* SR */
    69              port == 0x03ce || port == 0x03cf) { /* GR */

70 if (device->card_type < NV_40)
71 head = 0; /* CR44 selects head */
72 nv_wr08(obj, 0x0c0000 + (head * 0x2000) + port, data);
73 } else

regards,
dan carpenter