Re: [PATCH 05/59] drm/vboxvidoe: use managed pci functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The commit's headline says 'vboxvidoe'.

Am 15.04.20 um 09:39 schrieb Daniel Vetter:
> Allows us to drop the cleanup code on the floor.
> 
> Sam noticed in his review:
>> With this change we avoid calling pci_disable_device()
>> twise in case vbox_mm_init() fails.
>> Once in vbox_hw_fini() and once in the error path.
> 
> v2: Include Sam's review remarks
> 
> Acked-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Cc: Hans de Goede <hdegoede@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/vboxvideo/vbox_drv.c  | 6 ++----
>  drivers/gpu/drm/vboxvideo/vbox_main.c | 7 +------
>  2 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> index cfa4639c5142..cf2e3e6a2388 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> @@ -55,13 +55,13 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	pci_set_drvdata(pdev, vbox);
>  	mutex_init(&vbox->hw_mutex);
>  
> -	ret = pci_enable_device(pdev);
> +	ret = pcim_enable_device(pdev);
>  	if (ret)
>  		return ret;
>  
>  	ret = vbox_hw_init(vbox);
>  	if (ret)
> -		goto err_pci_disable;
> +		return ret;
>  
>  	ret = vbox_mm_init(vbox);
>  	if (ret)
> @@ -91,8 +91,6 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	vbox_mm_fini(vbox);
>  err_hw_fini:
>  	vbox_hw_fini(vbox);
> -err_pci_disable:
> -	pci_disable_device(pdev);
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c
> index 9dcab115a261..1336ab9795fc 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_main.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c
> @@ -71,8 +71,6 @@ static void vbox_accel_fini(struct vbox_private *vbox)
>  
>  	for (i = 0; i < vbox->num_crtcs; ++i)
>  		vbva_disable(&vbox->vbva_info[i], vbox->guest_pool, i);
> -
> -	pci_iounmap(vbox->ddev.pdev, vbox->vbva_buffers);
>  }
>  
>  /* Do we support the 4.3 plus mode hint reporting interface? */
> @@ -125,7 +123,7 @@ int vbox_hw_init(struct vbox_private *vbox)
>  	/* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
>  	vbox->guest_pool = gen_pool_create(4, -1);
>  	if (!vbox->guest_pool)
> -		goto err_unmap_guest_heap;
> +		return -ENOMEM;
>  
>  	ret = gen_pool_add_virt(vbox->guest_pool,
>  				(unsigned long)vbox->guest_heap,
> @@ -168,8 +166,6 @@ int vbox_hw_init(struct vbox_private *vbox)
>  
>  err_destroy_guest_pool:
>  	gen_pool_destroy(vbox->guest_pool);
> -err_unmap_guest_heap:
> -	pci_iounmap(vbox->ddev.pdev, vbox->guest_heap);
>  	return ret;
>  }
>  
> @@ -177,5 +173,4 @@ void vbox_hw_fini(struct vbox_private *vbox)
>  {
>  	vbox_accel_fini(vbox);
>  	gen_pool_destroy(vbox->guest_pool);
> -	pci_iounmap(vbox->ddev.pdev, vbox->guest_heap);
>  }
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux