Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/bluetooth Don't wait in interrupt context.



details:   https://anonhg.NetBSD.org/src/rev/31717ad04850
branches:  trunk
changeset: 1004852:31717ad04850
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Nov 16 22:06:49 2019 +0000

description:
Don't wait in interrupt context.

diffstat:

 sys/dev/bluetooth/bth5.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r f8e637eb3e25 -r 31717ad04850 sys/dev/bluetooth/bth5.c
--- a/sys/dev/bluetooth/bth5.c  Sat Nov 16 21:53:38 2019 +0000
+++ b/sys/dev/bluetooth/bth5.c  Sat Nov 16 22:06:49 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bth5.c,v 1.5 2017/09/03 23:11:19 nat Exp $     */
+/*     $NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $ */
 /*
  * Copyright (c) 2017 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.5 2017/09/03 23:11:19 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bth5.c,v 1.6 2019/11/16 22:06:49 mlelstv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1230,7 +1230,7 @@
 #endif
 
        sc->sc_seq_winspace--;
-       _retrans = m_copym(m, 0, M_COPYALL, M_WAIT);
+       _retrans = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
        if (_retrans == NULL) {
                aprint_error_dev(sc->sc_dev, "out of memory\n");
                goto out;
@@ -1488,7 +1488,12 @@
        if (!sc->sc_le_muzzled) {
                struct mbuf *m;
 
-               m = m_gethdr(M_WAIT, MT_DATA);
+               m = m_gethdr(M_DONTWAIT, MT_DATA);
+               if (m == NULL) {
+                       aprint_error_dev(sc->sc_dev,
+                           "le-packet transmit out of memory\n");
+                       return ENOMEM;
+               }
                m->m_pkthdr.len = m->m_len = 0;
                m_copyback(m, 0, sizeof(sync), sync);
                if (!bth5_tx_unreliable_pkt(sc, m, BTH5_CHANNEL_LE)) {



Home | Main Index | Thread Index | Old Index