From 22a92de5f87639011bdc119dfb3870ce3c238499 Mon Sep 17 00:00:00 2001 From: bouyer Date: Thu, 15 Mar 2012 18:39:21 +0000 Subject: [PATCH] Always init *val; some callers of zyd_read*() do not check the return value for error. Found by gcc -O3 --- sys/dev/usb/if_zyd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index e29828020ebb..5586580eec6d 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -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 @@ -22,7 +22,7 @@ * ZyDAS ZD1211/ZD1211B USB WLAN driver. */ #include -__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 @@ -852,6 +852,8 @@ zyd_read16(struct zyd_softc *sc, uint16_t reg, uint16_t *val) ZYD_CMD_FLAG_READ); if (error == 0) *val = le16toh(tmp.val); + else + *val = 0; return error; } @@ -868,6 +870,8 @@ zyd_read32(struct zyd_softc *sc, uint16_t reg, uint32_t *val) ZYD_CMD_FLAG_READ); if (error == 0) *val = le16toh(tmp[0].val) << 16 | le16toh(tmp[1].val); + else + *val = 0; return error; }