Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/audio audio(4): Clean up about audio_realloc().
details: https://anonhg.NetBSD.org/src/rev/d5abba0f063e
branches: trunk
changeset: 365755:d5abba0f063e
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Apr 23 11:30:57 2022 +0000
description:
audio(4): Clean up about audio_realloc().
- audio_realloc() never returns NULL, so there is no need to check it.
- audio_free() is no point in this case.
diffstat:
sys/dev/audio/audio.c | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diffs (53 lines):
diff -r a099c6958e6c -r d5abba0f063e sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c Sat Apr 23 09:59:13 2022 +0000
+++ b/sys/dev/audio/audio.c Sat Apr 23 11:30:57 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.131 2022/04/23 07:55:07 isaki Exp $ */
+/* $NetBSD: audio.c,v 1.132 2022/04/23 11:30:57 isaki Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.131 2022/04/23 07:55:07 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.132 2022/04/23 11:30:57 isaki Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -3689,7 +3689,8 @@
{
KASSERT(bytes != 0);
- audio_free(memblock);
+ if (memblock)
+ kern_free(memblock);
return kern_malloc(bytes, M_WAITOK);
}
@@ -4776,11 +4777,6 @@
track->outbuf.capacity *= NBLKOUT;
len = auring_bytelen(&track->outbuf);
track->outbuf.mem = audio_realloc(track->outbuf.mem, len);
- if (track->outbuf.mem == NULL) {
- device_printf(sc->sc_dev, "malloc outbuf(%d) failed\n", len);
- error = ENOMEM;
- goto error;
- }
/*
* On the recording track, expand the input stage buffer, which is
@@ -5387,12 +5383,6 @@
mixer->codecbuf.capacity = mixer->frames_per_block;
len = auring_bytelen(&mixer->codecbuf);
mixer->codecbuf.mem = audio_realloc(mixer->codecbuf.mem, len);
- if (mixer->codecbuf.mem == NULL) {
- device_printf(sc->sc_dev,
- "malloc codecbuf(%d) failed\n", len);
- error = ENOMEM;
- goto abort;
- }
}
/* Succeeded so display it. */
Home |
Main Index |
Thread Index |
Old Index