From owner-svn-src-all@FreeBSD.ORG Sun Aug 5 12:16:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19B3D106564A; Sun, 5 Aug 2012 12:16:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E04378FC16; Sun, 5 Aug 2012 12:16:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q75CGB37081912; Sun, 5 Aug 2012 12:16:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q75CGBIW081910; Sun, 5 Aug 2012 12:16:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201208051216.q75CGBIW081910@svn.freebsd.org> From: Dimitry Andric Date: Sun, 5 Aug 2012 12:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239059 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2012 12:16:12 -0000 Author: dim Date: Sun Aug 5 12:16:11 2012 New Revision: 239059 URL: http://svn.freebsd.org/changeset/base/239059 Log: In sbin/camcontrol/camcontrol.c, function smpcmd(), initialize the 'error' variable to zero, to avoid returning garbage in several cases. This fixes the following clang 3.2 warnings: sbin/camcontrol/camcontrol.c:4634:8: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (amt_written == -1) { ^~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4619:7: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (fd_response == 0) { ^~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4617:6: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ MFC after: 1 week Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun Aug 5 12:15:15 2012 (r239058) +++ head/sbin/camcontrol/camcontrol.c Sun Aug 5 12:16:11 2012 (r239059) @@ -4464,7 +4464,7 @@ static int smpcmd(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { - int c, error; + int c, error = 0; union ccb *ccb; uint8_t *smp_request = NULL, *smp_response = NULL; int request_size = 0, response_size = 0;