On Thu, Feb 14, 2019 at 06:34:59PM +0100, Hugo Lefeuvre wrote:
> @@ -402,6 +410,7 @@ static int handle_vsoc_cond_wait(struct file *filp, 
> struct vsoc_cond_wait *arg)
>       struct vsoc_region_data *data = vsoc_dev.regions_data + region_number;
>       int ret = 0;
>       struct vsoc_device_region *region_p = vsoc_region_from_filep(filp);
> +     struct vsoc_futex_wait_queue_t *it, *wait_queue = NULL;
                                             ^^^^^^^^^^^^^^^^^
>       atomic_t *address = NULL;
>       ktime_t wake_time;
>  
> @@ -415,10 +424,27 @@ static int handle_vsoc_cond_wait(struct file *filp, 
> struct vsoc_cond_wait *arg)
>       address = shm_off_to_virtual_addr(region_p->region_begin_offset +
>                                         arg->offset);
>  
> +     /* Find wait queue corresponding to offset or create it */
> +     spin_lock(&data->futex_wait_queue_lock);
> +     list_for_each_entry(it, &data->futex_wait_queue_list, list) {
> +             if (wait_queue->offset == arg->offset) {
                    ^^^^^^^^^^^^^^^^^^
You meant "it->offset".


> +                     wait_queue = it;
> +                     break;
> +             }
> +     }
> +
> +     if (!wait_queue) {
> +             wait_queue = kmalloc(sizeof(*wait_queue), GFP_KERNEL);
> +             wait_queue->offset = arg->offset;
> +             init_waitqueue_head(&wait_queue->queue);
> +             list_add(&wait_queue->list, &data->futex_wait_queue_list);
> +     }
> +     spin_unlock(&data->futex_wait_queue_lock);

regards,
dan carpenter
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to