All of lore.kernel.org
 help / color / mirror / Atom feed
* re: drm/nouveau/i2c: port to subdev interfaces
@ 2014-02-13  9:51 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2014-02-13  9:51 UTC (permalink / raw)
  To: bskeggs; +Cc: dri-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: drm/nouveau/i2c: port to subdev interfaces
@ 2015-03-19  9:49 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-03-19  9:49 UTC (permalink / raw)
  To: bskeggs; +Cc: dri-devel

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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-19  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19  9:49 drm/nouveau/i2c: port to subdev interfaces Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2014-02-13  9:51 Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.