The branch stable/12 has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a0d7f3d9004675b0da39745a0e17747a8d55beb4

commit a0d7f3d9004675b0da39745a0e17747a8d55beb4
Author:     Mark Johnston <[email protected]>
AuthorDate: 2021-01-08 18:32:04 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2021-01-11 14:42:15 +0000

    safexcel: Stop using a stack buffer for the ring lock name
    
    mtx_init() does not make a copy of the name so the buffer must be valid
    for the lifetime of the driver instance.  Store each ring's lock's name
    in the ring structure.
    
    (cherry picked from commit 8ba6acbbe6995efcd12c375e1826d55e35a8bdc9)
---
 sys/dev/safexcel/safexcel.c     | 6 +++---
 sys/dev/safexcel/safexcel_var.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c
index 9762a20e7c4d..079e9653bfb1 100644
--- a/sys/dev/safexcel/safexcel.c
+++ b/sys/dev/safexcel/safexcel.c
@@ -783,15 +783,15 @@ safexcel_init_rings(struct safexcel_softc *sc)
 {
        struct safexcel_cmd_descr *cdesc;
        struct safexcel_ring *ring;
-       char buf[32];
        uint64_t atok;
        int i, j;
 
        for (i = 0; i < sc->sc_config.rings; i++) {
                ring = &sc->sc_ring[i];
 
-               snprintf(buf, sizeof(buf), "safexcel_ring%d", i);
-               mtx_init(&ring->mtx, buf, NULL, MTX_DEF);
+               snprintf(ring->lockname, sizeof(ring->lockname),
+                   "safexcel_ring%d", i);
+               mtx_init(&ring->mtx, ring->lockname, NULL, MTX_DEF);
                STAILQ_INIT(&ring->free_requests);
                STAILQ_INIT(&ring->ready_requests);
                STAILQ_INIT(&ring->queued_requests);
diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h
index 4c6b9b73642a..b35ea8cead7b 100644
--- a/sys/dev/safexcel/safexcel_var.h
+++ b/sys/dev/safexcel/safexcel_var.h
@@ -392,6 +392,8 @@ struct safexcel_ring {
 
        struct safexcel_dma_mem         dma_atok;
        bus_dma_tag_t                   data_dtag;
+
+       char                            lockname[32];
 };
 
 struct safexcel_intr_handle {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to