diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-04-25 17:34:55 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-04-26 19:02:53 +0000 |
| commit | 95fa23b1c91c8660ef64ef5a20acfcd53961746e (patch) | |
| tree | 1c9da27c11ebd86d5596f5c41baffbf64fefc411 | |
| parent | 100e26fc80bc137237733b254a52de636d52c80e (diff) | |
| download | illumos-joyent-95fa23b1c91c8660ef64ef5a20acfcd53961746e.tar.gz | |
10847 fix smatch issue in zpool cmd
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
| -rw-r--r-- | usr/src/cmd/zpool/zpool_main.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c index 18f3dde658..240e74f6da 100644 --- a/usr/src/cmd/zpool/zpool_main.c +++ b/usr/src/cmd/zpool/zpool_main.c @@ -28,6 +28,7 @@ * Copyright 2016 Nexenta Systems, Inc. * Copyright (c) 2017 Datto Inc. * Copyright (c) 2017, Intel Corporation. + * Copyright 2019 Joyent, Inc. */ #include <assert.h> @@ -2894,10 +2895,8 @@ static const char *class_name[] = { * Print out all the statistics for the given vdev. This can either be the * toplevel configuration, or called recursively. If 'name' is NULL, then this * is a verbose output, and we don't want to display the toplevel pool stats. - * - * Returns the number of stat lines printed. */ -static unsigned int +static void print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, nvlist_t *newnv, iostat_cbdata_t *cb, int depth) { @@ -2906,12 +2905,11 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, vdev_stat_t *oldvs, *newvs; vdev_stat_t zerovs = { 0 }; char *vname; - int ret = 0; uint64_t tdelta; double scale; if (strcmp(name, VDEV_TYPE_INDIRECT) == 0) - return (ret); + return; if (oldnv != NULL) { verify(nvlist_lookup_uint64_array(oldnv, @@ -2959,15 +2957,15 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, (void) printf("\n"); if (!cb->cb_verbose) - return (ret); + return; if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_CHILDREN, &newchild, &children) != 0) - return (ret); + return; if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_CHILDREN, &oldchild, &c) != 0) - return (ret); + return; /* * print normal top-level devices @@ -3020,7 +3018,7 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, vname = zpool_vdev_name(g_zfs, zhp, newchild[c], cb->cb_name_flags); - ret += print_vdev_stats(zhp, vname, oldnv ? + print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } @@ -3032,11 +3030,11 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, &newchild, &children) != 0) - return (ret); + return; if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_L2CACHE, &oldchild, &c) != 0) - return (ret); + return; if (children > 0) { (void) printf("%-*s - - - - - " @@ -3049,8 +3047,6 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, free(vname); } } - - return (ret); } static int |
