Loading drivers/char/adsprpc.c +37 −14 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ struct fastrpc_file { int pd; char *spdname; 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 @@ -1896,12 +1896,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 @@ -2235,7 +2236,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 @@ -2289,7 +2290,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 for %s, returned 0x%x", __func__, current->comm, err); bail: Loading Loading @@ -2580,6 +2581,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 @@ -2635,6 +2643,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 @@ -2661,6 +2676,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 @@ -3191,13 +3213,14 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) int cid, err = 0; VERIFY(err, fl && fl->sctx); if (err) 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) return err; mutex_lock(&me->channel[cid].rpmsg_mutex); VERIFY(err, NULL != me->channel[cid].rpdev); Loading Loading @@ -3294,7 +3317,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 +37 −14 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ struct fastrpc_file { int pd; char *spdname; 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 @@ -1896,12 +1896,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 @@ -2235,7 +2236,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 @@ -2289,7 +2290,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 for %s, returned 0x%x", __func__, current->comm, err); bail: Loading Loading @@ -2580,6 +2581,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 @@ -2635,6 +2643,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 @@ -2661,6 +2676,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 @@ -3191,13 +3213,14 @@ static int fastrpc_channel_open(struct fastrpc_file *fl) int cid, err = 0; VERIFY(err, fl && fl->sctx); if (err) 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) return err; mutex_lock(&me->channel[cid].rpmsg_mutex); VERIFY(err, NULL != me->channel[cid].rpdev); Loading Loading @@ -3294,7 +3317,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