summaryrefslogtreecommitdiffstats
path: root/sys/dev/hatm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hatm')
-rw-r--r--sys/dev/hatm/if_hatm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c
index 0be8a3d..0677a14 100644
--- a/sys/dev/hatm/if_hatm.c
+++ b/sys/dev/hatm/if_hatm.c
@@ -1312,9 +1312,17 @@ kenv_getuint(struct hatm_softc *sc, const char *var,
*ptr = def;
- if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
- OID_AUTO, var, rw ? CTLFLAG_RW : CTLFLAG_RD, ptr, 0, "") == NULL)
- return (ENOMEM);
+ if (rw != 0) {
+ if (SYSCTL_ADD_UINT(&sc->sysctl_ctx,
+ SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var,
+ CTLFLAG_RW, ptr, 0, "") == NULL)
+ return (ENOMEM);
+ } else {
+ if (SYSCTL_ADD_UINT(&sc->sysctl_ctx,
+ SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var,
+ CTLFLAG_RD, ptr, 0, "") == NULL)
+ return (ENOMEM);
+ }
snprintf(full, sizeof(full), "hw.%s.%s",
device_get_nameunit(sc->dev), var);
OpenPOWER on IntegriCloud