summaryrefslogtreecommitdiff
path: root/drivers/misc/mic/scif/scif_fence.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/mic/scif/scif_fence.c')
-rw-r--r--drivers/misc/mic/scif/scif_fence.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/misc/mic/scif/scif_fence.c b/drivers/misc/mic/scif/scif_fence.c
index 7bb929f05d85..2e7ce6ae9dd2 100644
--- a/drivers/misc/mic/scif/scif_fence.c
+++ b/drivers/misc/mic/scif/scif_fence.c
@@ -195,10 +195,11 @@ static inline void *scif_get_local_va(off_t off, struct scif_window *window)
static void scif_prog_signal_cb(void *arg)
{
- struct scif_status *status = arg;
+ struct scif_cb_arg *cb_arg = arg;
- dma_pool_free(status->ep->remote_dev->signal_pool, status,
- status->src_dma_addr);
+ dma_pool_free(cb_arg->ep->remote_dev->signal_pool, cb_arg->status,
+ cb_arg->src_dma_addr);
+ kfree(cb_arg);
}
static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
@@ -209,6 +210,7 @@ static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
bool x100 = !is_dma_copy_aligned(chan->device, 1, 1, 1);
struct dma_async_tx_descriptor *tx;
struct scif_status *status = NULL;
+ struct scif_cb_arg *cb_arg = NULL;
dma_addr_t src;
dma_cookie_t cookie;
int err;
@@ -257,8 +259,16 @@ static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
goto dma_fail;
}
if (!x100) {
+ cb_arg = kmalloc(sizeof(*cb_arg), GFP_KERNEL);
+ if (!cb_arg) {
+ err = -ENOMEM;
+ goto dma_fail;
+ }
+ cb_arg->src_dma_addr = src;
+ cb_arg->status = status;
+ cb_arg->ep = ep;
tx->callback = scif_prog_signal_cb;
- tx->callback_param = status;
+ tx->callback_param = cb_arg;
}
cookie = tx->tx_submit(tx);
if (dma_submit_error(cookie)) {
@@ -270,9 +280,11 @@ static int _scif_prog_signal(scif_epd_t epd, dma_addr_t dst, u64 val)
dma_async_issue_pending(chan);
return 0;
dma_fail:
- if (!x100)
+ if (!x100) {
dma_pool_free(ep->remote_dev->signal_pool, status,
src - offsetof(struct scif_status, val));
+ kfree(cb_arg);
+ }
alloc_fail:
return err;
}