diff mbox

vfio: Use ERR_CAST() instead of open coding it

Message ID 20170518073431.sc6x2at4n4j7hngu@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter May 18, 2017, 7:34 a.m. UTC
It's a small cleanup to use ERR_CAST() here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Alex Williamson June 13, 2017, 3:30 p.m. UTC | #1
On Thu, 18 May 2017 10:34:31 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> It's a small cleanup to use ERR_CAST() here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 561084ab387f..6a49485eb49d 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -382,7 +382,7 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group)
>  	if (IS_ERR(dev)) {
>  		vfio_free_group_minor(minor);
>  		vfio_group_unlock_and_free(group);
> -		return (struct vfio_group *)dev; /* ERR_PTR */
> +		return ERR_CAST(dev);
>  	}
>  
>  	group->minor = minor;

Applied to next branch for v4.13, thanks Dan!

Alex
diff mbox

Patch

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 561084ab387f..6a49485eb49d 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -382,7 +382,7 @@  static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group)
 	if (IS_ERR(dev)) {
 		vfio_free_group_minor(minor);
 		vfio_group_unlock_and_free(group);
-		return (struct vfio_group *)dev; /* ERR_PTR */
+		return ERR_CAST(dev);
 	}
 
 	group->minor = minor;