>> Use additional labels so that a bit of exception handling can be better
>> reused at the end of two function implementations.
…
>> +++ b/drivers/gpu/drm/virtio/virtgpu_vram.c
>> @@ -212,16 +212,12 @@ int virtio_gpu_vram_create(struct virtio_gpu_device 
>> *vgdev,
>>  
>>      /* Create fake offset */
>>      ret = drm_gem_create_mmap_offset(obj);
>> -    if (ret) {
>> -            kfree(vram);
>> -            return ret;
>> -    }
>> +    if (ret)
>> +            goto free_vram;
>>  
>>      ret = virtio_gpu_resource_id_get(vgdev, &vram->base.hw_res_handle);
>> -    if (ret) {
>> -            kfree(vram);
>> -            return ret;
>> -    }
>> +    if (ret)
>> +            goto free_vram;
>>  
>>      virtio_gpu_cmd_resource_create_blob(vgdev, &vram->base, params, NULL,
>>                                          0);
>> @@ -237,6 +233,10 @@ int virtio_gpu_vram_create(struct virtio_gpu_device 
>> *vgdev,
>>  
>>      *bo_ptr = &vram->base;
>>      return 0;
>> +
>> +free_vram:
>> +    kfree(vram);
>> +    return ret;
>>  }
>>  
>>  void virtio_gpu_vram_map_deferred(struct virtio_gpu_object_vram *vram)
> 
> Please see [1], will be great if you could address the reported issues
> with this patch in v2

Do you indicate that you would prefer an other coding style for the application
of goto chains?


>                       and add another patch fixing the
> virtio_gpu_resource_id_get() error handling.
> 
> [1]
> https://sashiko.dev/#/patchset/b7440806-e9e8-4027-afe1-f6fe9297d8b2%40web.de
Do you request to achieve corresponding resource cleanup after a failed
virtio_gpu_resource_id_get() call by any other function call instead of 
kfree(vram)?

Regards,
Markus

Reply via email to