drm/nouveau/i2c: port to subdev interfaces

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 19 02:49:48 PDT 2015


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/nvkm/engine/disp/vga.c:41 nv_rdport()
	warn: we tested 'port == 962' before and it was 'false'

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

drivers/gpu/drm/nouveau/nvkm/engine/disp/vga.c
    29  nv_rdport(void *obj, int head, u16 port)
    30  {
    31          struct nvkm_device *device = nv_device(obj);
    32  
    33          if (device->card_type >= NV_50)
    34                  return nv_rd08(obj, 0x601000 + port);
    35  
    36          if (port == 0x03c0 || port == 0x03c1 || /* AR */
    37              port == 0x03c2 || port == 0x03da || /* INP0 */
                            ^^^^^^
We return here.

    38              port == 0x03d4 || port == 0x03d5)   /* CR */
    39                  return nv_rd08(obj, 0x601000 + (head * 0x2000) + port);
    40  
    41          if (port == 0x03c2 || port == 0x03cc || /* MISC */
                            ^^^^^^
Duplicate.  Probably one of these is a typo but I don't know which.

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

    67              port == 0x03c4 || port == 0x03c5 || /* SR */
    68              port == 0x03ce || port == 0x03cf) { /* GR */
    69                  if (device->card_type < NV_40)
    70                          head = 0; /* CR44 selects head */
    71                  nv_wr08(obj, 0x0c0000 + (head * 0x2000) + port, data);

regards,
dan carpenter


More information about the dri-devel mailing list