aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorDamian Szuberski <[email protected]>2022-02-21 04:20:00 +0100
committerGitHub <[email protected]>2022-02-20 19:20:00 -0800
commit806739f991aa0d3fc5a36989fff8d8ab8fddf78f (patch)
treec486b2dd5f9d9ade96b7e5e897193607fcaa241d /module/zfs
parente41013078a90d5790c737eec573ec376ca21a234 (diff)
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 <[email protected]> Signed-off-by: szubersk <[email protected]> Closes #12167 Closes #13103
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zcp_get.c12
1 files changed, 5 insertions, 7 deletions
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));