summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2011-01-01 15:18:23 +0000
committerkettenis <kettenis@openbsd.org>2011-01-01 15:18:23 +0000
commit7a1810dbcdb89532583d8f309547fb0fd30def45 (patch)
tree134b50b0bf48baf7da59b353664e7c9e952edb07
parentcleanup, no binary change. (diff)
downloadwireguard-openbsd-7a1810dbcdb89532583d8f309547fb0fd30def45.tar.xz
wireguard-openbsd-7a1810dbcdb89532583d8f309547fb0fd30def45.zip
Only store bus/dev/func numbers when the corresponding pointer argument
isn't NULL.
-rw-r--r--sys/arch/hppa/dev/dino.c11
-rw-r--r--sys/arch/hppa/dev/elroy.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/sys/arch/hppa/dev/dino.c b/sys/arch/hppa/dev/dino.c
index 8a460806f8e..49c5e95c342 100644
--- a/sys/arch/hppa/dev/dino.c
+++ b/sys/arch/hppa/dev/dino.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dino.c,v 1.29 2010/12/04 17:06:31 miod Exp $ */
+/* $OpenBSD: dino.c,v 1.30 2011/01/01 15:20:19 kettenis Exp $ */
/*
* Copyright (c) 2003-2005 Michael Shalayeff
@@ -313,9 +313,12 @@ dino_make_tag(void *v, int bus, int dev, int func)
void
dino_decompose_tag(void *v, pcitag_t tag, int *bus, int *dev, int *func)
{
- *bus = (tag >> 16) & 0xff;
- *dev = (tag >> 11) & 0x1f;
- *func= (tag >> 8) & 0x07;
+ if (bus)
+ *bus = (tag >> 16) & 0xff;
+ if (dev)
+ *dev = (tag >> 11) & 0x1f;
+ if (func)
+ *func= (tag >> 8) & 0x07;
}
int
diff --git a/sys/arch/hppa/dev/elroy.c b/sys/arch/hppa/dev/elroy.c
index 21631ad4632..17018417931 100644
--- a/sys/arch/hppa/dev/elroy.c
+++ b/sys/arch/hppa/dev/elroy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elroy.c,v 1.8 2010/12/04 17:06:31 miod Exp $ */
+/* $OpenBSD: elroy.c,v 1.9 2011/01/01 15:18:23 kettenis Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -233,9 +233,12 @@ elroy_make_tag(void *v, int bus, int dev, int func)
void
elroy_decompose_tag(void *v, pcitag_t tag, int *bus, int *dev, int *func)
{
- *bus = (tag >> 16) & 0xff;
- *dev = (tag >> 11) & 0x1f;
- *func= (tag >> 8) & 0x07;
+ if (bus)
+ *bus = (tag >> 16) & 0xff;
+ if (dev)
+ *dev = (tag >> 11) & 0x1f;
+ if (func)
+ *func= (tag >> 8) & 0x07;
}
int