PERFORCE change 167171 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Aug 10 13:25:39 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=167171

Change 167171 by hselasky at hselasky_laptop001 on 2009/08/10 13:25:35

	
	USB misc:
	 - move fflags check to correct function.
	 - reported by: Krassimir Slavchev

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/misc/ufm.c#10 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/misc/ufm.c#10 (text+ko) ====

@@ -86,11 +86,9 @@
 static device_detach_t ufm_detach;
 
 static usb_fifo_ioctl_t ufm_ioctl;
-static usb_fifo_open_t ufm_open;
 
 static struct usb_fifo_methods ufm_fifo_methods = {
 	.f_ioctl = &ufm_ioctl,
-	.f_open = &ufm_open,
 	.basename[0] = "ufm",
 };
 
@@ -179,15 +177,6 @@
 }
 
 static int
-ufm_open(struct usb_fifo *dev, int fflags)
-{
-	if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
-		return (EACCES);
-	}
-	return (0);
-}
-
-static int
 ufm_do_req(struct ufm_softc *sc, uint8_t request,
     uint16_t value, uint16_t index, uint8_t *retbuf)
 {
@@ -315,6 +304,10 @@
 	struct ufm_softc *sc = usb_fifo_softc(fifo);
 	int error = 0;
 
+	if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
+		return (EACCES);
+	}
+
 	switch (cmd) {
 	case FM_SET_FREQ:
 		error = ufm_set_freq(sc, addr);


More information about the p4-projects mailing list