Page MenuHomeFreeBSD

D25706.id74787.diff
No OneTemporary

D25706.id74787.diff

Index: head/sys/compat/linuxkpi/common/src/linux_usb.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_usb.c
+++ head/sys/compat/linuxkpi/common/src/linux_usb.c
@@ -707,8 +707,6 @@
* 0xFFFF is a FreeBSD specific magic value.
*/
urb = usb_alloc_urb(0xFFFF, size);
- if (urb == NULL)
- return (-ENOMEM);
urb->dev = dev;
urb->endpoint = uhe;
@@ -1008,16 +1006,14 @@
}
urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
- if (urb) {
- cv_init(&urb->cv_wait, "URBWAIT");
- if (iso_packets == 0xFFFF) {
- urb->setup_packet = (void *)(urb + 1);
- urb->transfer_buffer = (void *)(urb->setup_packet +
- sizeof(struct usb_device_request));
- } else {
- urb->number_of_packets = iso_packets;
- }
+ cv_init(&urb->cv_wait, "URBWAIT");
+ if (iso_packets == 0xFFFF) {
+ urb->setup_packet = (void *)(urb + 1);
+ urb->transfer_buffer = (void *)(urb->setup_packet +
+ sizeof(struct usb_device_request));
+ } else {
+ urb->number_of_packets = iso_packets;
}
return (urb);
}
@@ -1722,8 +1718,6 @@
return (err);
urb = usb_alloc_urb(0, 0);
- if (urb == NULL)
- return (-ENOMEM);
usb_fill_bulk_urb(urb, udev, uhe, data, len,
usb_linux_wait_complete, NULL);
Index: head/sys/dev/sound/usb/uaudio.c
===================================================================
--- head/sys/dev/sound/usb/uaudio.c
+++ head/sys/dev/sound/usb/uaudio.c
@@ -4968,10 +4968,6 @@
iot = malloc(sizeof(struct uaudio_terminal_node) * 256, M_TEMP,
M_WAITOK | M_ZERO);
- if (iot == NULL) {
- DPRINTF("no memory!\n");
- goto done;
- }
while ((desc = usb_desc_foreach(cd, desc))) {
dp = desc;
Index: head/sys/dev/usb/input/uhid.c
===================================================================
--- head/sys/dev/usb/input/uhid.c
+++ head/sys/dev/usb/input/uhid.c
@@ -451,10 +451,6 @@
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
- if (kern_data == NULL) {
- err = ENOMEM;
- goto done;
- }
free_data = 1;
}
err = usbd_req_get_report(sc->sc_udev, NULL, kern_data,
@@ -487,10 +483,6 @@
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
- if (kern_data == NULL) {
- err = ENOMEM;
- goto done;
- }
free_data = 1;
err = copyin(user_data, kern_data, len);
if (err) {
Index: head/sys/dev/usb/input/uhid_snes.c
===================================================================
--- head/sys/dev/usb/input/uhid_snes.c
+++ head/sys/dev/usb/input/uhid_snes.c
@@ -168,10 +168,6 @@
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
- if (kern_data == NULL) {
- err = ENOMEM;
- goto done;
- }
free_data = 1;
}
err = usbd_req_get_report(sc->sc_udev, NULL, kern_data,
@@ -203,10 +199,6 @@
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
- if (kern_data == NULL) {
- err = ENOMEM;
- goto done;
- }
free_data = 1;
err = copyin(user_data, kern_data, len);
if (err) {
Index: head/sys/dev/usb/storage/ustorage_fs.c
===================================================================
--- head/sys/dev/usb/storage/ustorage_fs.c
+++ head/sys/dev/usb/storage/ustorage_fs.c
@@ -381,10 +381,6 @@
ustorage_fs_ramdisk =
malloc(USTORAGE_FS_RAM_SECT << 9, M_USB,
M_ZERO | M_WAITOK);
-
- if (ustorage_fs_ramdisk == NULL) {
- return (ENOMEM);
- }
}
sc->sc_lun[0].memory_image = ustorage_fs_ramdisk;
sc->sc_lun[0].num_sectors = USTORAGE_FS_RAM_SECT;
Index: head/sys/dev/usb/usb_dev.c
===================================================================
--- head/sys/dev/usb/usb_dev.c
+++ head/sys/dev/usb/usb_dev.c
@@ -386,13 +386,11 @@
struct usb_fifo *f;
f = malloc(sizeof(*f), M_USBDEV, M_WAITOK | M_ZERO);
- if (f != NULL) {
- cv_init(&f->cv_io, "FIFO-IO");
- cv_init(&f->cv_drain, "FIFO-DRAIN");
- f->priv_mtx = mtx;
- f->refcount = 1;
- knlist_init_mtx(&f->selinfo.si_note, mtx);
- }
+ cv_init(&f->cv_io, "FIFO-IO");
+ cv_init(&f->cv_drain, "FIFO-DRAIN");
+ f->priv_mtx = mtx;
+ f->refcount = 1;
+ knlist_init_mtx(&f->selinfo.si_note, mtx);
return (f);
}
@@ -2309,9 +2307,6 @@
struct usb_symlink *ps;
ps = malloc(sizeof(*ps), M_USBDEV, M_WAITOK);
- if (ps == NULL) {
- return (ps);
- }
/* XXX no longer needed */
strlcpy(ps->src_path, target, sizeof(ps->src_path));
ps->src_len = strlen(ps->src_path);
Index: head/sys/dev/usb/usb_device.c
===================================================================
--- head/sys/dev/usb/usb_device.c
+++ head/sys/dev/usb/usb_device.c
@@ -1785,9 +1785,11 @@
return (NULL);
}
udev = malloc(sizeof(*udev), M_USB, M_WAITOK | M_ZERO);
+#if (USB_HAVE_MALLOC_WAITOK == 0)
if (udev == NULL) {
return (NULL);
}
+#endif
/* initialise our SX-lock */
sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS);
Index: head/sys/dev/usb/usb_freebsd.h
===================================================================
--- head/sys/dev/usb/usb_freebsd.h
+++ head/sys/dev/usb/usb_freebsd.h
@@ -53,6 +53,7 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
#define USB_HAVE_DISABLE_ENUM 1
+#define USB_HAVE_MALLOC_WAITOK 1
/* define zero ticks callout value */
#define USB_CALLOUT_ZERO_TICKS 1
Index: head/sys/dev/usb/usb_freebsd_loader.h
===================================================================
--- head/sys/dev/usb/usb_freebsd_loader.h
+++ head/sys/dev/usb/usb_freebsd_loader.h
@@ -53,6 +53,7 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
#define USB_HAVE_DISABLE_ENUM 0
+#define USB_HAVE_MALLOC_WAITOK 0
#define USB_CALLOUT_ZERO_TICKS 1
Index: head/sys/dev/usb/usb_generic.c
===================================================================
--- head/sys/dev/usb/usb_generic.c
+++ head/sys/dev/usb/usb_generic.c
@@ -2339,11 +2339,6 @@
}
f->fs_xfer = malloc(sizeof(f->fs_xfer[0]) *
u.pinit->ep_index_max, M_USB, M_WAITOK | M_ZERO);
- if (f->fs_xfer == NULL) {
- usb_fifo_free_buffer(f);
- error = ENOMEM;
- break;
- }
f->fs_ep_max = u.pinit->ep_index_max;
f->fs_ep_ptr = u.pinit->pEndpoints;
break;
Index: head/sys/dev/usb/usb_mbuf.c
===================================================================
--- head/sys/dev/usb/usb_mbuf.c
+++ head/sys/dev/usb/usb_mbuf.c
@@ -78,15 +78,10 @@
alloc_size = (block_size + sizeof(struct usb_mbuf)) * nblocks;
free_ptr = malloc(alloc_size, type, M_WAITOK | M_ZERO);
-
- if (free_ptr == NULL) {
- goto done;
- }
m_ptr = free_ptr;
data_ptr = (void *)(m_ptr + nblocks);
while (nblocks--) {
-
m_ptr->cur_data_ptr =
m_ptr->min_data_ptr = data_ptr;
@@ -99,6 +94,5 @@
data_ptr += block_size;
}
}
-done:
return (free_ptr);
}
Index: head/sys/dev/usb/usb_transfer.c
===================================================================
--- head/sys/dev/usb/usb_transfer.c
+++ head/sys/dev/usb/usb_transfer.c
@@ -1342,14 +1342,15 @@
/* allocate zeroed memory */
buf = malloc(parm->size[0], M_USB, M_WAITOK | M_ZERO);
-
+#if (USB_HAVE_MALLOC_WAITOK == 0)
if (buf == NULL) {
parm->err = USB_ERR_NOMEM;
DPRINTFN(0, "cannot allocate memory block for "
"configuration (%d bytes)\n",
parm->size[0]);
goto done;
- }
+ }
+#endif
parm->dma_tag_p = USB_ADD_BYTES(buf, parm->size[1]);
parm->dma_page_ptr = USB_ADD_BYTES(buf, parm->size[3]);
parm->dma_page_cache_ptr = USB_ADD_BYTES(buf, parm->size[4]);

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 1, 5:56 PM (6 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27441756
Default Alt Text
D25706.id74787.diff (7 KB)

Event Timeline