Re: [PATCH v3 12/30] drivers: hv: dxgkrnl: Sharing of dxgresource objects

From: Wei Liu
Date: Wed Mar 02 2022 - 09:13:12 EST


On Tue, Mar 01, 2022 at 11:45:59AM -0800, Iouri Tarassov wrote:
[...]
>
> +static int dxgsharedresource_seal(struct dxgsharedresource *shared_resource)
> +{
> + int ret = 0;
> + int i = 0;
> + u8 *private_data;
> + u32 data_size;
> + struct dxgresource *resource;
> + struct dxgallocation *alloc;
> +
> + pr_debug("Sealing resource: %p", shared_resource);
> +
> + down_write(&shared_resource->adapter->shared_resource_list_lock);
> + if (shared_resource->sealed) {
> + pr_debug("Resource already sealed");
> + goto cleanup;
> + }
> + shared_resource->sealed = 1;
> + if (!list_empty(&shared_resource->resource_list_head)) {
[...]
> + }
> +cleanup1:

Please just name it unlock ...

> + mutex_unlock(&resource->resource_mutex);
> + }
> +cleanup:

... and rename this to done because you are not cleaning up anything.

> + up_write(&shared_resource->adapter->shared_resource_list_lock);
> + return ret;
> +}
> +

Thanks,
Wei.