From cca5be248f1a85e258ece93b4d828e5aebdef009 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Mon, 23 Nov 2020 13:02:23 +0000 Subject: [PATCH] Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free. Reviewed by: imp MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26841 --- sys/dev/tws/tws.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/tws/tws.c b/sys/dev/tws/tws.c index 8cbb523cee84..a065f7753dee 100644 --- a/sys/dev/tws/tws.c +++ b/sys/dev/tws/tws.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include MALLOC_DEFINE(M_TWS, "twsbuf", "buffers used by tws driver"); int tws_queue_depth = TWS_MAX_REQS; @@ -412,7 +413,7 @@ tws_detach(device_t dev) callout_drain(&sc->stats_timer); free(sc->reqs, M_TWS); free(sc->sense_bufs, M_TWS); - free(sc->scan_ccb, M_TWS); + xpt_free_ccb(sc->scan_ccb); if (sc->ioctl_data_mem) bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, sc->ioctl_data_map); if (sc->data_tag) @@ -597,7 +598,7 @@ tws_init(struct tws_softc *sc) M_WAITOK | M_ZERO); sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS, M_WAITOK | M_ZERO); - sc->scan_ccb = malloc(sizeof(union ccb), M_TWS, M_WAITOK | M_ZERO); + sc->scan_ccb = xpt_alloc_ccb(); if (bus_dmamem_alloc(sc->data_tag, (void **)&sc->ioctl_data_mem, (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &sc->ioctl_data_map)) { device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\n");