staging: fsl-mc: Fixed bug in fsl_mc_allocator_remove
authorJ. German Rivera <German.Rivera@freescale.com>
Sat, 17 Oct 2015 16:18:20 +0000 (11:18 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 Oct 2015 03:53:38 +0000 (20:53 -0700)
Call fsl_mc_resource_pool_remove_device() only if mc_dev->resource
is not NULL.

Signed-off-by: J. German Rivera <German.Rivera@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-mc/bus/mc-allocator.c

index 527cb4bc379adf8ec70cf6485c8daddd3ab8cb65..e9c3dec201cb8413207855a7373f45008380c284 100644 (file)
@@ -511,9 +511,11 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
        if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type)))
                goto out;
 
-       error = fsl_mc_resource_pool_remove_device(mc_dev);
-       if (error < 0)
-               goto out;
+       if (mc_dev->resource) {
+               error = fsl_mc_resource_pool_remove_device(mc_dev);
+               if (error < 0)
+                       goto out;
+       }
 
        dev_dbg(&mc_dev->dev,
                "Allocatable MC object device unbound from fsl_mc_allocator driver");