Author: mav
Date: Mon Mar 21 00:22:09 2016
New Revision: 297115
URL: https://svnweb.freebsd.org/changeset/base/297115

Log:
  MFC r296528: MFV r296527:  6659 nvlist_free(NULL) is a no-op
  
  Reviewed by: Toomas Soome <tso...@me.com>
  Reviewed by: Marcel Telka <mar...@telka.sk>
  Approved by: Robert Mustacchi <r...@joyent.com>
  Author: Josef 'Jeff' Sipek <jef...@josefsipek.net>
  
  illumos/illumos-gate@aab83bb83be7342f6cfccaed8d5fe0b2f404855d

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c       Mon Mar 21 
00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c       Mon Mar 21 
00:22:09 2016        (r297115)
@@ -5407,8 +5407,7 @@ zfs_do_allow_unallow_impl(int argc, char
 
 cleanup0:
        nvlist_free(perm_nvl);
-       if (update_perm_nvl != NULL)
-               nvlist_free(update_perm_nvl);
+       nvlist_free(update_perm_nvl);
 cleanup1:
        fs_perm_set_fini(&fs_perm_set);
 cleanup2:

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Mar 21 
00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Mar 21 
00:22:09 2016        (r297115)
@@ -3413,8 +3413,7 @@ zpool_do_split(int argc, char **argv)
                        if (add_prop_list(
                            zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg,
                            &props, B_TRUE) != 0) {
-                               if (props)
-                                       nvlist_free(props);
+                               nvlist_free(props);
                                usage(B_FALSE);
                        }
                        break;
@@ -3427,8 +3426,7 @@ zpool_do_split(int argc, char **argv)
                                propval++;
                                if (add_prop_list(optarg, propval,
                                    &props, B_TRUE) != 0) {
-                                       if (props)
-                                               nvlist_free(props);
+                                       nvlist_free(props);
                                        usage(B_FALSE);
                                }
                        } else {

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Mon Mar 21 
00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Mon Mar 21 
00:22:09 2016        (r297115)
@@ -1445,8 +1445,7 @@ split_mirror_vdev(zpool_handle_t *zhp, c
        }
 
        if (zpool_vdev_split(zhp, newname, &newroot, props, flags) != 0) {
-               if (newroot != NULL)
-                       nvlist_free(newroot);
+               nvlist_free(newroot);
                return (NULL);
        }
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c        
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c        
Mon Mar 21 00:22:09 2016        (r297115)
@@ -318,8 +318,7 @@ zpool_refresh_stats(zpool_handle_t *zhp,
                verify(nvlist_lookup_uint64(config,
                    ZPOOL_CONFIG_POOL_TXG, &newtxg) == 0);
 
-               if (zhp->zpool_old_config != NULL)
-                       nvlist_free(zhp->zpool_old_config);
+               nvlist_free(zhp->zpool_old_config);
 
                if (oldtxg != newtxg) {
                        nvlist_free(zhp->zpool_config);

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c       
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c       
Mon Mar 21 00:22:09 2016        (r297115)
@@ -2058,8 +2058,7 @@ get_numeric_property(zfs_handle_t *zhp, 
                        zcmd_free_nvlists(&zc);
                        return (-1);
                }
-               if (zplprops)
-                       nvlist_free(zplprops);
+               nvlist_free(zplprops);
                zcmd_free_nvlists(&zc);
                break;
 
@@ -4334,8 +4333,7 @@ zfs_smb_acl_mgmt(libzfs_handle_t *hdl, c
                return (-1);
        }
        error = ioctl(hdl->libzfs_fd, ZFS_IOC_SMB_ACL, &zc);
-       if (nvlist)
-               nvlist_free(nvlist);
+       nvlist_free(nvlist);
        return (error);
 }
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c        
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c        
Mon Mar 21 00:22:09 2016        (r297115)
@@ -1331,8 +1331,7 @@ error:
                        venext = ve->ve_next;
                        for (ce = ve->ve_configs; ce != NULL; ce = cenext) {
                                cenext = ce->ce_next;
-                               if (ce->ce_config)
-                                       nvlist_free(ce->ce_config);
+                               nvlist_free(ce->ce_config);
                                free(ce);
                        }
                        free(ve);

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Mon Mar 
21 00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c  Mon Mar 
21 00:22:09 2016        (r297115)
@@ -1054,12 +1054,9 @@ zpool_open(libzfs_handle_t *hdl, const c
 void
 zpool_close(zpool_handle_t *zhp)
 {
-       if (zhp->zpool_config)
-               nvlist_free(zhp->zpool_config);
-       if (zhp->zpool_old_config)
-               nvlist_free(zhp->zpool_old_config);
-       if (zhp->zpool_props)
-               nvlist_free(zhp->zpool_props);
+       nvlist_free(zhp->zpool_config);
+       nvlist_free(zhp->zpool_old_config);
+       nvlist_free(zhp->zpool_props);
        free(zhp);
 }
 
@@ -1577,8 +1574,7 @@ zpool_import(libzfs_handle_t *hdl, nvlis
 
        ret = zpool_import_props(hdl, config, newname, props,
            ZFS_IMPORT_NORMAL);
-       if (props)
-               nvlist_free(props);
+       nvlist_free(props);
        return (ret);
 }
 
@@ -2901,8 +2897,7 @@ zpool_vdev_split(zpool_handle_t *zhp, ch
            &children) != 0) {
                zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                    "Source pool is missing vdev tree"));
-               if (zc_props)
-                       nvlist_free(zc_props);
+               nvlist_free(zc_props);
                return (-1);
        }
 
@@ -3050,10 +3045,8 @@ out:
                free(varray);
        }
        zcmd_free_nvlists(&zc);
-       if (zc_props)
-               nvlist_free(zc_props);
-       if (newconfig)
-               nvlist_free(newconfig);
+       nvlist_free(zc_props);
+       nvlist_free(newconfig);
        if (freelist) {
                nvlist_free(*newroot);
                *newroot = NULL;

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==============================================================================
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c      
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c      
Mon Mar 21 00:22:09 2016        (r297115)
@@ -2794,8 +2794,7 @@ zfs_receive_package(libzfs_handle_t *hdl
 
 out:
        fsavl_destroy(stream_avl);
-       if (stream_nv)
-               nvlist_free(stream_nv);
+       nvlist_free(stream_nv);
        if (softerr)
                error = -2;
        if (anyerr)

Modified: 
stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c   
Mon Mar 21 00:22:09 2016        (r297115)
@@ -544,8 +544,7 @@ nvpair_free(nvpair_t *nvp)
                int i;
 
                for (i = 0; i < NVP_NELEM(nvp); i++)
-                       if (nvlp[i] != NULL)
-                               nvlist_free(nvlp[i]);
+                       nvlist_free(nvlp[i]);
                break;
        }
        default:

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c      Mon Mar 
21 00:20:49 2016        (r297114)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c      Mon Mar 
21 00:22:09 2016        (r297115)
@@ -6348,8 +6348,7 @@ spa_sync_config_object(spa_t *spa, dmu_t
 
        spa_config_exit(spa, SCL_STATE, FTAG);
 
-       if (spa->spa_config_syncing)
-               nvlist_free(spa->spa_config_syncing);
+       nvlist_free(spa->spa_config_syncing);
        spa->spa_config_syncing = config;
 
        spa_sync_nvlist(spa, spa->spa_config_object, config, tx);

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c       
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c       
Mon Mar 21 00:22:09 2016        (r297115)
@@ -367,8 +367,7 @@ void
 spa_config_set(spa_t *spa, nvlist_t *config)
 {
        mutex_enter(&spa->spa_props_lock);
-       if (spa->spa_config != NULL)
-               nvlist_free(spa->spa_config);
+       nvlist_free(spa->spa_config);
        spa->spa_config = config;
        mutex_exit(&spa->spa_props_lock);
 }

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c        
Mon Mar 21 00:20:49 2016        (r297114)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c        
Mon Mar 21 00:22:09 2016        (r297115)
@@ -1601,8 +1601,7 @@ zfs_ioc_pool_import(zfs_cmd_t *zc)
 
        nvlist_free(config);
 
-       if (props)
-               nvlist_free(props);
+       nvlist_free(props);
 
        return (error);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to