Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi In some cases the gcc optimizer is not smart ...



details:   https://anonhg.NetBSD.org/src/rev/e4a4f61462cf
branches:  trunk
changeset: 359881:e4a4f61462cf
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jan 29 11:20:30 2022 +0000

description:
In some cases the gcc optimizer is not smart enough to figure out why
the luns and nluns variables are never actually used when they are not
initialized - so initialize them always.

diffstat:

 sys/dev/scsipi/scsiconf.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 64da1ee7936c -r e4a4f61462cf sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Sat Jan 29 10:44:40 2022 +0000
+++ b/sys/dev/scsipi/scsiconf.c Sat Jan 29 11:20:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsiconf.c,v 1.296 2022/01/28 18:23:28 christos Exp $  */
+/*     $NetBSD: scsiconf.c,v 1.297 2022/01/29 11:20:30 martin Exp $    */
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.296 2022/01/28 18:23:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.297 2022/01/29 11:20:30 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -477,8 +477,8 @@
 static void
 scsi_discover_luns(struct scsibus_softc *sc, int target, int minlun, int maxlun)
 {
-       uint16_t *luns;
-       size_t nluns;
+       uint16_t *luns = NULL;  /* XXX gcc */
+       size_t nluns = 0;       /* XXX gcc */
 
        if (scsi_report_luns(sc, target, &luns, &nluns) == 0) {
                for (size_t i = 0; i < nluns; i++)



Home | Main Index | Thread Index | Old Index