From owner-svn-src-all@freebsd.org Thu Apr 7 21:33:15 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5854DB07F47; Thu, 7 Apr 2016 21:33:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A2F81821; Thu, 7 Apr 2016 21:33:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u37LXEw0035658; Thu, 7 Apr 2016 21:33:14 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u37LXETl035657; Thu, 7 Apr 2016 21:33:14 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604072133.u37LXETl035657@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 7 Apr 2016 21:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297688 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 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: Thu, 07 Apr 2016 21:33:15 -0000 Author: pfg Date: Thu Apr 7 21:33:14 2016 New Revision: 297688 URL: https://svnweb.freebsd.org/changeset/base/297688 Log: chdone(): Prevent returning uninitialized scalar value. Improve over the solution in r297527: Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken MFC after: 2 weeks Modified: head/sys/cam/scsi/scsi_ch.c Modified: head/sys/cam/scsi/scsi_ch.c ============================================================================== --- head/sys/cam/scsi/scsi_ch.c Thu Apr 7 20:30:46 2016 (r297687) +++ head/sys/cam/scsi/scsi_ch.c Thu Apr 7 21:33:14 2016 (r297688) @@ -648,10 +648,14 @@ chdone(struct cam_periph *periph, union softc->sc_counts[CHET_IE], PLURAL(softc->sc_counts[CHET_IE])); #undef PLURAL + if (announce_buf[0] != '\0') { + xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } } else { int error; - announce_buf[0] = '\0'; error = cherror(done_ccb, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT); /* @@ -715,14 +719,8 @@ chdone(struct cam_periph *periph, union cam_periph_invalidate(periph); - announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); - xpt_announce_quirks(periph, softc->quirks, - CH_Q_BIT_STRING); - } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /*