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);
                /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to