From 4b5125cac5210c5f9dbeea992e0ed98a8167700a Mon Sep 17 00:00:00 2001 From: plunky Date: Mon, 11 Sep 2006 21:59:09 +0000 Subject: btsco.c: - sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t, not an int. So change sc_mtu's type to uint16_t. - Try a little harder to ensure btsco_round_blocksize() does not return zero. Prevents a subsequent panic in audio_init_ringbuffer(). from scw@ --- sys/dev/bluetooth/btsco.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/bluetooth/btsco.c b/sys/dev/bluetooth/btsco.c index 73ff962178a..eb7357adafe 100644 --- a/sys/dev/bluetooth/btsco.c +++ b/sys/dev/bluetooth/btsco.c @@ -1,4 +1,4 @@ -/* $NetBSD: btsco.c,v 1.3 2006/09/10 15:45:56 plunky Exp $ */ +/* $NetBSD: btsco.c,v 1.4 2006/09/11 21:59:09 plunky Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.3 2006/09/10 15:45:56 plunky Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.4 2006/09/11 21:59:09 plunky Exp $"); #include #include @@ -97,7 +97,7 @@ struct btsco_softc { uint16_t sc_state; /* link state */ struct sco_pcb *sc_sco; /* SCO handle */ struct sco_pcb *sc_sco_l; /* SCO listen handle */ - int sc_mtu; /* SCO mtu */ + uint16_t sc_mtu; /* SCO mtu */ uint8_t sc_channel; /* RFCOMM channel */ int sc_err; /* stored error */ @@ -770,8 +770,11 @@ btsco_round_blocksize(void *hdl, int bs, int mode, const audio_params_t *param) { struct btsco_softc *sc = hdl; - if (sc->sc_mtu > 0) + if (sc->sc_mtu > 0) { bs = (bs / sc->sc_mtu) * sc->sc_mtu; + if (bs == 0) + bs = sc->sc_mtu; + } DPRINTF("%s mode=0x%x, bs=%d, sc_mtu=%d\n", device_xname((struct device *)sc), mode, bs, sc->sc_mtu); -- cgit