From 84e0df3fcf094f3664ecff7a5e1e8165a5787a09 Mon Sep 17 00:00:00 2001 From: Mike Heffner Date: Sun, 9 Dec 2001 07:32:55 +0000 Subject: [PATCH] WARNS=2 cleanup and fix potential unitialized variable bug. PR: bin/32567 MFC after: 2 weeks --- usr.sbin/devinfo/Makefile | 2 ++ usr.sbin/devinfo/devinfo.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/usr.sbin/devinfo/Makefile b/usr.sbin/devinfo/Makefile index 31891886b51c..f260e3b98460 100644 --- a/usr.sbin/devinfo/Makefile +++ b/usr.sbin/devinfo/Makefile @@ -6,4 +6,6 @@ NOMAN= #true DPADD= ${LIBDEVINFO} LDADD= -ldevinfo +WARNS?= 2 + .include diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c index 6f9bc5b15adf..c74de6cdef12 100644 --- a/usr.sbin/devinfo/devinfo.c +++ b/usr.sbin/devinfo/devinfo.c @@ -39,6 +39,13 @@ int rflag; +static void print_resource(struct devinfo_res *); +static int print_device_matching_resource(struct devinfo_res *, void *); +static int print_device_rman_resources(struct devinfo_rman *, void *); +static int print_device(struct devinfo_dev *, void *); +static int print_rman_resource(struct devinfo_res *, void *); +static int print_rman(struct devinfo_rman *, void *); + struct indent_arg { int indent; @@ -130,7 +137,7 @@ print_device(struct devinfo_dev *dev, void *arg) int i, indent; if (dev->dd_name[0] != 0) { - indent = (int)arg; + indent = (int)(intptr_t)arg; for (i = 0; i < indent; i++) printf(" "); printf("%s\n", dev->dd_name); @@ -143,14 +150,14 @@ print_device(struct devinfo_dev *dev, void *arg) } return(devinfo_foreach_device_child(dev, print_device, - (void *)(indent + 2))); + (void *)((char *)arg + 2))); } /* * Print information about a resource under a resource manager. */ int -print_rman_resource(struct devinfo_res *res, void *arg) +print_rman_resource(struct devinfo_res *res, void *arg __unused) { struct devinfo_dev *dev; @@ -170,7 +177,7 @@ print_rman_resource(struct devinfo_res *res, void *arg) * Print information about a resource manager. */ int -print_rman(struct devinfo_rman *rman, void *arg) +print_rman(struct devinfo_rman *rman, void *arg __unused) { printf("%s:\n", rman->dm_desc); devinfo_foreach_rman_resource(rman, print_rman_resource, 0);