diff options
| -rw-r--r-- | drivers/platform/msm/gsi/gsi.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index 20351dd8a492..502c225ed1c2 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-2018, 2021, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -18,6 +18,7 @@ #include <linux/msm_gsi.h> #include <linux/platform_device.h> #include <linux/delay.h> +#include <linux/slab.h> #include "gsi.h" #include "gsi_reg.h" @@ -1605,7 +1606,7 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, { struct gsi_chan_ctx *ctx; uint32_t val; - int res; + int res, size; int ee; enum gsi_ch_cmd_opcode op = GSI_CH_ALLOCATE; uint8_t erindex; @@ -1650,9 +1651,8 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, } memset(ctx, 0, sizeof(*ctx)); - user_data = devm_kzalloc(gsi_ctx->dev, - (props->ring_len / props->re_size) * sizeof(void *), - GFP_KERNEL); + size = (props->ring_len / props->re_size) * sizeof(void *); + user_data = kzalloc(size, GFP_KERNEL); if (user_data == NULL) { GSIERR("%s:%d gsi context not allocated\n", __func__, __LINE__); return -GSI_STATUS_RES_ALLOC_FAILURE; @@ -1675,14 +1675,14 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, if (res == 0) { GSIERR("chan_hdl=%u timed out\n", props->ch_id); mutex_unlock(&gsi_ctx->mlock); - devm_kfree(gsi_ctx->dev, user_data); + kfree(user_data); return -GSI_STATUS_TIMED_OUT; } if (ctx->state != GSI_CHAN_STATE_ALLOCATED) { GSIERR("chan_hdl=%u allocation failed state=%d\n", props->ch_id, ctx->state); mutex_unlock(&gsi_ctx->mlock); - devm_kfree(gsi_ctx->dev, user_data); + kfree(user_data); return -GSI_STATUS_RES_ALLOC_FAILURE; } mutex_unlock(&gsi_ctx->mlock); @@ -2129,7 +2129,7 @@ int gsi_dealloc_channel(unsigned long chan_hdl) mutex_unlock(&gsi_ctx->mlock); - devm_kfree(gsi_ctx->dev, ctx->user_data); + kfree(ctx->user_data); ctx->allocated = false; if (ctx->evtr) atomic_dec(&ctx->evtr->chan_ref_cnt); |
