Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Always init *val; some callers of zyd_read*() do...



details:   https://anonhg.NetBSD.org/src/rev/b4386e850b13
branches:  trunk
changeset: 778091:b4386e850b13
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Mar 15 18:39:21 2012 +0000

description:
Always init *val; some callers of zyd_read*() do not check the return
value for error. Found by gcc -O3

diffstat:

 sys/dev/usb/if_zyd.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 9f916171bba2 -r b4386e850b13 sys/dev/usb/if_zyd.c
--- a/sys/dev/usb/if_zyd.c      Thu Mar 15 18:38:37 2012 +0000
+++ b/sys/dev/usb/if_zyd.c      Thu Mar 15 18:39:21 2012 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
-/*     $NetBSD: if_zyd.c,v 1.29 2011/07/18 05:57:40 jruoho Exp $       */
+/*     $NetBSD: if_zyd.c,v 1.30 2012/03/15 18:39:21 bouyer Exp $       */
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -22,7 +22,7 @@
  * ZyDAS ZD1211/ZD1211B USB WLAN driver.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.29 2011/07/18 05:57:40 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.30 2012/03/15 18:39:21 bouyer Exp $");
 
 
 #include <sys/param.h>
@@ -852,6 +852,8 @@
            ZYD_CMD_FLAG_READ);
        if (error == 0)
                *val = le16toh(tmp.val);
+       else
+               *val = 0;
        return error;
 }
 
@@ -868,6 +870,8 @@
            ZYD_CMD_FLAG_READ);
        if (error == 0)
                *val = le16toh(tmp[0].val) << 16 | le16toh(tmp[1].val);
+       else
+               *val = 0;
        return error;
 }
 



Home | Main Index | Thread Index | Old Index