if (mem_region == NULL) {
vpu_err("allocate memory for iommu memory region failed\n");
ion_free(pservice->ion_client, hdl);
- return -1;
+ return -ENOMEM;
}
mem_region->hdl = hdl;
vpu_err("fd %d ion map iommu failed\n", fd);
kfree(mem_region);
ion_free(pservice->ion_client, hdl);
- return ret;
+ return -EFAULT;
}
INIT_LIST_HEAD(&mem_region->reg_lnk);
list_add_tail(&mem_region->reg_lnk, ®->mem_region_list);
* on current decoding task. Then kernel driver can only translate the first
* address then copy it all pps buffer.
*/
-static void fill_scaling_list_addr_in_pps(
+static int fill_scaling_list_addr_in_pps(
struct vpu_subdev_data *data,
struct vpu_reg *reg,
char *pps,
if (scaling_fd > 0) {
int i = 0;
u32 tmp = vcodec_fd_to_iova(data, reg, scaling_fd);
+
+ if (IS_ERR_VALUE(tmp))
+ return -1;
tmp += scaling_offset;
for (i = 0; i < pps_info_count; i++, base += pps_info_size) {
pps[base + 3] = (tmp >> 24) & 0xff;
}
}
+
+ return 0;
}
static int vcodec_bufid_to_iova(struct vpu_subdev_data *data, const u8 *tbl,
"scaling list setting pps %p\n", pps);
pps += pps_info_offset;
- fill_scaling_list_addr_in_pps(
+ if (fill_scaling_list_addr_in_pps(
data, reg, pps,
pps_info_count,
pps_info_size,
- scaling_list_addr_offset);
+ scaling_list_addr_offset) < 0) {
+ ion_free(pservice->ion_client, hdl);
+ return -1;
+ }
}
}
if (!mem_region) {
ion_free(pservice->ion_client, hdl);
- return -1;
+ return -ENOMEM;
}
mem_region->hdl = hdl;
vpu_debug_enter();
if (NULL == reg) {
- vpu_err("error: kmalloc fail in reg_init\n");
+ vpu_err("error: kmalloc failed\n");
return NULL;
}
INIT_LIST_HEAD(®->mem_region_list);
if (copy_from_user(®->reg[0], (void __user *)src, size)) {
- vpu_err("error: copy_from_user failed in reg_init\n");
+ vpu_err("error: copy_from_user failed\n");
kfree(reg);
return NULL;
}
if (copy_from_user(&extra_info, (u8 *)src + size, extra_size)) {
- vpu_err("error: copy_from_user failed in reg_init\n");
+ vpu_err("error: copy_from_user failed\n");
kfree(reg);
return NULL;
}
mutex_lock(&pservice->shutdown_lock);
if (atomic_read(&pservice->service_on) == 0) {
- mutex_lock(&pservice->shutdown_lock);
+ mutex_unlock(&pservice->shutdown_lock);
return;
}
if (!list_empty(&pservice->waiting)) {
}
if (copy_to_user(dst, ®->reg[base], size)) {
- vpu_err("error: return_reg copy_to_user failed\n");
+ vpu_err("error: copy_to_user failed\n");
return -EFAULT;
}