Loading drivers/char/adsprpc.c +38 −15 Original line number Diff line number Diff line Loading @@ -385,7 +385,7 @@ struct fastrpc_file { int pd; char *servloc_name; int file_close; int dsp_process_init; int dsp_proc_init; struct fastrpc_apps *apps; struct hlist_head perf; struct dentry *debugfs_file; Loading Loading @@ -1909,12 +1909,13 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, } } VERIFY(err, fl->sctx != NULL); if (err) goto bail; VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS); if (err) VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS && fl->sctx != NULL); if (err) { pr_err("adsprpc: ERROR: %s: user application %s domain is not set\n", __func__, current->comm); err = -EBADR; goto bail; } if (!kernel) { VERIFY(err, 0 == context_restore_interrupted(fl, inv, Loading Loading @@ -2262,7 +2263,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, err = -ENOTTY; goto bail; } fl->dsp_process_init = 1; fl->dsp_proc_init = 1; bail: kfree(proc_name); if (err && (init->flags == FASTRPC_INIT_CREATE_STATIC)) Loading Loading @@ -2460,7 +2461,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err && fl->dsp_process_init) if (err && fl->dsp_proc_init) pr_err("adsprpc: %s: releasing DSP process failed with %d (0x%x) for %s\n", __func__, err, err, current->comm); bail: Loading Loading @@ -2749,6 +2750,13 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl, struct fastrpc_buf *rbuf = NULL, *free = NULL; struct hlist_node *n; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to unmap without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->internal_map_mutex); spin_lock(&fl->hlock); Loading Loading @@ -2804,6 +2812,13 @@ static int fastrpc_internal_munmap_fd(struct fastrpc_file *fl, VERIFY(err, (fl && ud)); if (err) goto bail; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to unmap without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->map_mutex); if (fastrpc_mmap_find(fl, ud->fd, ud->va, ud->len, 0, 0, &map)) { pr_err("adsprpc: mapping not found to unmap fd 0x%x, va 0x%llx, len 0x%x\n", Loading @@ -2830,6 +2845,13 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl, uintptr_t raddr = 0; int err = 0; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to map without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->internal_map_mutex); if (ud->flags == ADSP_MMAP_ADD_PAGES) { if (ud->vaddrin) { Loading Loading @@ -3361,13 +3383,14 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) struct fastrpc_apps *me = &gfa; int cid, err = 0; VERIFY(err, fl && fl->sctx); if (err) goto bail; VERIFY(err, fl && fl->sctx && fl->cid >= 0 && fl->cid < NUM_CHANNELS); if (err) { pr_err("adsprpc: ERROR: %s: user application %s domain is not set\n", __func__, current->comm); err = -EBADR; return err; } cid = fl->cid; VERIFY(err, cid >= 0 && cid < NUM_CHANNELS); if (err) goto bail; mutex_lock(&me->channel[cid].rpmsg_mutex); VERIFY(err, NULL != me->channel[cid].rpdev); Loading Loading @@ -3463,7 +3486,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) fl->debugfs_file = debugfs_file; memset(&fl->perf, 0, sizeof(fl->perf)); fl->qos_request = 0; fl->dsp_process_init = 0; fl->dsp_proc_init = 0; filp->private_data = fl; mutex_init(&fl->internal_map_mutex); mutex_init(&fl->map_mutex); Loading Loading
drivers/char/adsprpc.c +38 −15 Original line number Diff line number Diff line Loading @@ -385,7 +385,7 @@ struct fastrpc_file { int pd; char *servloc_name; int file_close; int dsp_process_init; int dsp_proc_init; struct fastrpc_apps *apps; struct hlist_head perf; struct dentry *debugfs_file; Loading Loading @@ -1909,12 +1909,13 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode, } } VERIFY(err, fl->sctx != NULL); if (err) goto bail; VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS); if (err) VERIFY(err, fl->cid >= 0 && fl->cid < NUM_CHANNELS && fl->sctx != NULL); if (err) { pr_err("adsprpc: ERROR: %s: user application %s domain is not set\n", __func__, current->comm); err = -EBADR; goto bail; } if (!kernel) { VERIFY(err, 0 == context_restore_interrupted(fl, inv, Loading Loading @@ -2262,7 +2263,7 @@ static int fastrpc_init_process(struct fastrpc_file *fl, err = -ENOTTY; goto bail; } fl->dsp_process_init = 1; fl->dsp_proc_init = 1; bail: kfree(proc_name); if (err && (init->flags == FASTRPC_INIT_CREATE_STATIC)) Loading Loading @@ -2460,7 +2461,7 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl) ioctl.crc = NULL; VERIFY(err, 0 == (err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, 1, &ioctl))); if (err && fl->dsp_process_init) if (err && fl->dsp_proc_init) pr_err("adsprpc: %s: releasing DSP process failed with %d (0x%x) for %s\n", __func__, err, err, current->comm); bail: Loading Loading @@ -2749,6 +2750,13 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl, struct fastrpc_buf *rbuf = NULL, *free = NULL; struct hlist_node *n; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to unmap without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->internal_map_mutex); spin_lock(&fl->hlock); Loading Loading @@ -2804,6 +2812,13 @@ static int fastrpc_internal_munmap_fd(struct fastrpc_file *fl, VERIFY(err, (fl && ud)); if (err) goto bail; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to unmap without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->map_mutex); if (fastrpc_mmap_find(fl, ud->fd, ud->va, ud->len, 0, 0, &map)) { pr_err("adsprpc: mapping not found to unmap fd 0x%x, va 0x%llx, len 0x%x\n", Loading @@ -2830,6 +2845,13 @@ static int fastrpc_internal_mmap(struct fastrpc_file *fl, uintptr_t raddr = 0; int err = 0; VERIFY(err, fl->dsp_proc_init == 1); if (err) { pr_err("adsprpc: ERROR: %s: user application %s trying to map without initialization\n", __func__, current->comm); err = -EBADR; goto bail; } mutex_lock(&fl->internal_map_mutex); if (ud->flags == ADSP_MMAP_ADD_PAGES) { if (ud->vaddrin) { Loading Loading @@ -3361,13 +3383,14 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) struct fastrpc_apps *me = &gfa; int cid, err = 0; VERIFY(err, fl && fl->sctx); if (err) goto bail; VERIFY(err, fl && fl->sctx && fl->cid >= 0 && fl->cid < NUM_CHANNELS); if (err) { pr_err("adsprpc: ERROR: %s: user application %s domain is not set\n", __func__, current->comm); err = -EBADR; return err; } cid = fl->cid; VERIFY(err, cid >= 0 && cid < NUM_CHANNELS); if (err) goto bail; mutex_lock(&me->channel[cid].rpmsg_mutex); VERIFY(err, NULL != me->channel[cid].rpdev); Loading Loading @@ -3463,7 +3486,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) fl->debugfs_file = debugfs_file; memset(&fl->perf, 0, sizeof(fl->perf)); fl->qos_request = 0; fl->dsp_process_init = 0; fl->dsp_proc_init = 0; filp->private_data = fl; mutex_init(&fl->internal_map_mutex); mutex_init(&fl->map_mutex); Loading