summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/uvideo.c6
-rw-r--r--sys/dev/video.c7
2 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index 7dbd0176847..d33e3079acd 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.205 2019/10/14 09:20:48 mpi Exp $ */
+/* $OpenBSD: uvideo.c,v 1.206 2020/01/16 09:59:26 mpi Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -644,11 +644,11 @@ uvideo_detach(struct device *self, int flags)
/* Wait for outstanding requests to complete */
usbd_delay_ms(sc->sc_udev, UVIDEO_NFRAMES_MAX);
- uvideo_vs_free_frame(sc);
-
if (sc->sc_videodev != NULL)
rv = config_detach(sc->sc_videodev, flags);
+ uvideo_vs_free_frame(sc);
+
return (rv);
}
diff --git a/sys/dev/video.c b/sys/dev/video.c
index 61e37fb1d04..e0ea556a58f 100644
--- a/sys/dev/video.c
+++ b/sys/dev/video.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: video.c,v 1.42 2019/10/06 17:13:10 mpi Exp $ */
+/* $OpenBSD: video.c,v 1.43 2020/01/16 09:59:26 mpi Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -463,9 +463,6 @@ videodetach(struct device *self, int flags)
struct video_softc *sc = (struct video_softc *)self;
int maj, mn;
- if (sc->sc_fbuffer != NULL)
- free(sc->sc_fbuffer, M_DEVBUF, sc->sc_fbufferlen);
-
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == videoopen)
@@ -475,6 +472,8 @@ videodetach(struct device *self, int flags)
mn = self->dv_unit;
vdevgone(maj, mn, mn, VCHR);
+ free(sc->sc_fbuffer, M_DEVBUF, sc->sc_fbufferlen);
+
return (0);
}