aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenlei Huang <zlei@FreeBSD.org>2024-09-03 10:25:33 +0000
committerZhenlei Huang <zlei@FreeBSD.org>2024-09-03 10:25:33 +0000
commit59121599bbda1e4c3fc3c6e887cd48cd5e3afc70 (patch)
treeec5be2daab343074152834072611734b5f396174
parent761339c5544a360df9d3bab70675fea246eb6a83 (diff)
downloadsrc-59121599bbda1e4c3fc3c6e887cd48cd5e3afc70.tar.gz
src-59121599bbda1e4c3fc3c6e887cd48cd5e3afc70.zip
sound: Stop checking for failures from malloc(M_WAITOK)
Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45852
-rw-r--r--sys/dev/sound/macio/i2s.c6
-rw-r--r--sys/dev/sound/usb/uaudio.c44
2 files changed, 21 insertions, 29 deletions
diff --git a/sys/dev/sound/macio/i2s.c b/sys/dev/sound/macio/i2s.c
index 5f8cb3aa15f7..647d66c27bba 100644
--- a/sys/dev/sound/macio/i2s.c
+++ b/sys/dev/sound/macio/i2s.c
@@ -241,10 +241,8 @@ i2s_attach(device_t self)
* Register a hook for delayed attach in order to allow
* the I2C controller to attach.
*/
- if ((i2s_delayed_attach = malloc(sizeof(struct intr_config_hook),
- M_TEMP, M_WAITOK | M_ZERO)) == NULL)
- return (ENOMEM);
-
+ i2s_delayed_attach = malloc(sizeof(struct intr_config_hook),
+ M_TEMP, M_WAITOK | M_ZERO);
i2s_delayed_attach->ich_func = i2s_postattach;
i2s_delayed_attach->ich_arg = sc;
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 166af8a0857d..0a8878c072d2 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -2687,8 +2687,6 @@ uaudio_chan_init(struct uaudio_chan *ch, struct snd_dbuf *b,
DPRINTF("Worst case buffer is %d bytes\n", (int)buf_size);
ch->buf = malloc(buf_size, M_DEVBUF, M_WAITOK | M_ZERO);
- if (ch->buf == NULL)
- goto error;
if (sndbuf_setup(b, ch->buf, buf_size) != 0)
goto error;
@@ -3256,31 +3254,27 @@ uaudio_mixer_add_ctl_sub(struct uaudio_softc *sc, struct uaudio_mixer_node *mc)
malloc(sizeof(*p_mc_new), M_USBDEV, M_WAITOK);
int ch;
- if (p_mc_new != NULL) {
- memcpy(p_mc_new, mc, sizeof(*p_mc_new));
- p_mc_new->next = sc->sc_mixer_root;
- sc->sc_mixer_root = p_mc_new;
- sc->sc_mixer_count++;
+ memcpy(p_mc_new, mc, sizeof(*p_mc_new));
+ p_mc_new->next = sc->sc_mixer_root;
+ sc->sc_mixer_root = p_mc_new;
+ sc->sc_mixer_count++;
- /* set default value for all channels */
- for (ch = 0; ch < p_mc_new->nchan; ch++) {
- switch (p_mc_new->val_default) {
- case 1:
- /* 50% */
- p_mc_new->wData[ch] = (p_mc_new->maxval + p_mc_new->minval) / 2;
- break;
- case 2:
- /* 100% */
- p_mc_new->wData[ch] = p_mc_new->maxval;
- break;
- default:
- /* 0% */
- p_mc_new->wData[ch] = p_mc_new->minval;
- break;
- }
+ /* set default value for all channels */
+ for (ch = 0; ch < p_mc_new->nchan; ch++) {
+ switch (p_mc_new->val_default) {
+ case 1:
+ /* 50% */
+ p_mc_new->wData[ch] = (p_mc_new->maxval + p_mc_new->minval) / 2;
+ break;
+ case 2:
+ /* 100% */
+ p_mc_new->wData[ch] = p_mc_new->maxval;
+ break;
+ default:
+ /* 0% */
+ p_mc_new->wData[ch] = p_mc_new->minval;
+ break;
}
- } else {
- DPRINTF("out of memory\n");
}
}