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.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
This commit is contained in:
Mark Johnston 2021-01-08 13:32:04 -05:00
parent 501159696c
commit 8ba6acbbe6
2 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -384,6 +384,8 @@ struct safexcel_ring {
struct safexcel_dma_mem dma_atok;
bus_dma_tag_t data_dtag;
char lockname[32];
};
struct safexcel_intr_handle {