From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: re: drm/nouveau/i2c: port to subdev interfaces Date: Thu, 13 Feb 2014 12:51:26 +0300 Message-ID: <20140213095125.GA27408@elgon.mountain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B980FB25D for ; Thu, 13 Feb 2014 01:51:22 -0800 (PST) Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: bskeggs@redhat.com Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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