Fri Mar 6 12:54:29 2015 UTC ()
Use USBD_NOMEM rather than ENOMEM where appropriate.


(skrll)
diff -r1.162.2.16 -r1.162.2.17 src/sys/dev/usb/usbdi.c

cvs diff -r1.162.2.16 -r1.162.2.17 src/sys/dev/usb/usbdi.c (expand / switch to unified diff)

--- src/sys/dev/usb/usbdi.c 2015/03/06 12:52:51 1.162.2.16
+++ src/sys/dev/usb/usbdi.c 2015/03/06 12:54:29 1.162.2.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: usbdi.c,v 1.162.2.16 2015/03/06 12:52:51 skrll Exp $ */ 1/* $NetBSD: usbdi.c,v 1.162.2.17 2015/03/06 12:54:29 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson (lennart@augustsson.net) at 8 * by Lennart Augustsson (lennart@augustsson.net) at
9 * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au). 9 * Carlstedt Research & Technology and Matthew R. Green (mrg@eterna.com.au).
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.16 2015/03/06 12:52:51 skrll Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.17 2015/03/06 12:54:29 skrll Exp $");
35 35
36#ifdef _KERNEL_OPT 36#ifdef _KERNEL_OPT
37#include "opt_usb.h" 37#include "opt_usb.h"
38#include "opt_compat_netbsd.h" 38#include "opt_compat_netbsd.h"
39#endif 39#endif
40 40
41#include "usb_dma.h" 41#include "usb_dma.h"
42 42
43#include <sys/param.h> 43#include <sys/param.h>
44#include <sys/systm.h> 44#include <sys/systm.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/device.h> 46#include <sys/device.h>
47#include <sys/kmem.h> 47#include <sys/kmem.h>
@@ -214,27 +214,27 @@ usbd_open_pipe_intr(usbd_interface_handl @@ -214,27 +214,27 @@ usbd_open_pipe_intr(usbd_interface_handl
214 214
215 err = usbd_open_pipe_ival(iface, address, 215 err = usbd_open_pipe_ival(iface, address,
216 USBD_EXCLUSIVE_USE | (flags & USBD_MPSAFE), 216 USBD_EXCLUSIVE_USE | (flags & USBD_MPSAFE),
217 &ipipe, ival); 217 &ipipe, ival);
218 if (err) 218 if (err)
219 return err; 219 return err;
220 xfer = usbd_alloc_xfer(iface->ui_dev); 220 xfer = usbd_alloc_xfer(iface->ui_dev);
221 if (xfer == NULL) { 221 if (xfer == NULL) {
222 err = USBD_NOMEM; 222 err = USBD_NOMEM;
223 goto bad1; 223 goto bad1;
224 } 224 }
225 void *buf = usbd_alloc_buffer(xfer, len); 225 void *buf = usbd_alloc_buffer(xfer, len);
226 if (buf == NULL) { 226 if (buf == NULL) {
227 err = ENOMEM; 227 err = USBD_NOMEM;
228 goto bad2; 228 goto bad2;
229 } 229 }
230 230
231 usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags, 231 usbd_setup_xfer(xfer, ipipe, priv, buffer, len, flags,
232 USBD_NO_TIMEOUT, cb); 232 USBD_NO_TIMEOUT, cb);
233 ipipe->up_intrxfer = xfer; 233 ipipe->up_intrxfer = xfer;
234 ipipe->up_repeat = 1; 234 ipipe->up_repeat = 1;
235 err = usbd_transfer(xfer); 235 err = usbd_transfer(xfer);
236 *pipe = ipipe; 236 *pipe = ipipe;
237 if (err != USBD_IN_PROGRESS) 237 if (err != USBD_IN_PROGRESS)
238 goto bad3; 238 goto bad3;
239 return USBD_NORMAL_COMPLETION; 239 return USBD_NORMAL_COMPLETION;
240 240