NetBSD Problem Report #53177

From www@NetBSD.org  Thu Apr 12 18:02:45 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C6EE17A1CF
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 12 Apr 2018 18:02:45 +0000 (UTC)
Message-Id: <20180412180244.D26237A212@mollari.NetBSD.org>
Date: Thu, 12 Apr 2018 18:02:44 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/dev/i2c/xc5k.c:162: missing error checking ?
X-Send-Pr-Version: www-1.0

>Number:         53177
>Category:       kern
>Synopsis:       src/sys/dev/i2c/xc5k.c:162: missing error checking ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 12 18:05:00 +0000 2018
>Closed-Date:    Mon Jun 04 08:46:05 +0000 2018
>Last-Modified:  Mon Jun 04 08:46:05 +0000 2018
>Originator:     David Binderman
>Release:        cvs-20180412
>Organization:
>Environment:
>Description:
src/sys/dev/i2c/xc5k.c:162] -> [src/sys/dev/i2c/xc5k.c:165]: (warning) Identical inner 'if' condition is always true.

Source code is

        if (!error) {
                xc5k_read_2(xc, XC5K_REG_VERSION, &xcversion);
                xc5k_read_2(xc, XC5K_REG_BUILD, &xcbuild);
                if (!error)

Suggest sanity check return value from xc5k_read_2 function
for both calls.


>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53177 CVS commit: src/sys/dev/i2c
Date: Thu, 12 Apr 2018 17:14:53 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Apr 12 21:14:53 UTC 2018

 Modified Files:
 	src/sys/dev/i2c: xc5k.c

 Log Message:
 PR/53177: David Binderman: Better error handling


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/xc5k.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/53177 CVS commit: src/sys/dev/i2c
Date: Fri, 13 Apr 2018 16:42:51 +0000

 On Thu, Apr 12, 2018 at 09:15:01PM +0000, Christos Zoulas wrote:
  >  Modified Files:
  >  	src/sys/dev/i2c: xc5k.c
  >  
  >  Log Message:
  >  PR/53177: David Binderman: Better error handling

 Shouldn't it print something like "couldn't find firmware revision" if
 the accesses fail?

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 08:46:05 +0000
State-Changed-Why:
Fix committed by christos. Thanks for the report!
I think this case is unlikely to be encountered in real use, so without a report of that happening, not requesting a pullup.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.