From 806739f991aa0d3fc5a36989fff8d8ab8fddf78f Mon Sep 17 00:00:00 2001 From: Damian Szuberski Date: Mon, 21 Feb 2022 04:20:00 +0100 Subject: Correct compilation errors reported by GCC 10/11 New `zfs_type_t` value `ZFS_TYPE_INVALID` is introduced. Variable initialization is now possible to make GCC happy. Reviewed by: Brian Behlendorf Signed-off-by: szubersk Closes #12167 Closes #13103 --- module/zfs/zcp_get.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'module/zfs') diff --git a/module/zfs/zcp_get.c b/module/zfs/zcp_get.c index 420ed3f71..af495ce85 100644 --- a/module/zfs/zcp_get.c +++ b/module/zfs/zcp_get.c @@ -76,9 +76,8 @@ get_objset_type(dsl_dataset_t *ds, zfs_type_t *type) static int get_objset_type_name(dsl_dataset_t *ds, char *str) { - int error; - zfs_type_t type; - error = get_objset_type(ds, &type); + zfs_type_t type = ZFS_TYPE_INVALID; + int error = get_objset_type(ds, &type); if (error != 0) return (error); switch (type) { @@ -230,7 +229,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname, char *strval = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP); char setpoint[ZFS_MAX_DATASET_NAME_LEN] = "Internal error - setpoint not determined"; - zfs_type_t ds_type = -1; + zfs_type_t ds_type = ZFS_TYPE_INVALID; zprop_type_t prop_type = zfs_prop_get_type(zfs_prop); (void) get_objset_type(ds, &ds_type); @@ -497,8 +496,7 @@ get_zap_prop(lua_State *state, dsl_dataset_t *ds, zfs_prop_t zfs_prop) boolean_t prop_valid_for_ds(dsl_dataset_t *ds, zfs_prop_t zfs_prop) { - int error; - zfs_type_t zfs_type; + zfs_type_t zfs_type = ZFS_TYPE_INVALID; /* properties not supported */ if ((zfs_prop == ZFS_PROP_ISCSIOPTIONS) || @@ -509,7 +507,7 @@ prop_valid_for_ds(dsl_dataset_t *ds, zfs_prop_t zfs_prop) if ((zfs_prop == ZFS_PROP_ORIGIN) && (!dsl_dir_is_clone(ds->ds_dir))) return (B_FALSE); - error = get_objset_type(ds, &zfs_type); + int error = get_objset_type(ds, &zfs_type); if (error != 0) return (B_FALSE); return (zfs_prop_valid_for_type(zfs_prop, zfs_type, B_FALSE)); -- cgit v1.2.3