diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c --- a/sys/dev/gpio/gpioc.c +++ b/sys/dev/gpio/gpioc.c @@ -677,16 +677,10 @@ gpioc_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct gpioc_cdevpriv *priv; - int err; priv = malloc(sizeof(*priv), M_GPIOC, M_WAITOK | M_ZERO); priv->sc = dev->si_drv1; priv->report_option = GPIO_EVENT_REPORT_DETAIL; - err = devfs_set_cdevpriv(priv, gpioc_cdevpriv_dtor); - if (err != 0) { - gpioc_cdevpriv_dtor(priv); - return (err); - } mtx_init(&priv->mtx, "gpioc priv", NULL, MTX_DEF); knlist_init_mtx(&priv->selinfo.si_note, &priv->mtx); @@ -701,7 +695,7 @@ priv->events = malloc(priv->numevents * sizeof(struct gpio_event_detail), M_GPIOC, M_WAITOK | M_ZERO); - return (0); + return devfs_set_cdevpriv(priv, gpioc_cdevpriv_dtor); } static int