staging: fsl-mc: Fixed bug in fsl_mc_allocator_remove

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>
This commit is contained in:
J. German Rivera 2015-10-17 11:18:20 -05:00 committed by Greg Kroah-Hartman
parent 95e9a09af4
commit 6958cd4483
1 changed files with 5 additions and 3 deletions

View 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))) if (WARN_ON(!FSL_MC_IS_ALLOCATABLE(mc_dev->obj_desc.type)))
goto out; goto out;
error = fsl_mc_resource_pool_remove_device(mc_dev); if (mc_dev->resource) {
if (error < 0) error = fsl_mc_resource_pool_remove_device(mc_dev);
goto out; if (error < 0)
goto out;
}
dev_dbg(&mc_dev->dev, dev_dbg(&mc_dev->dev,
"Allocatable MC object device unbound from fsl_mc_allocator driver"); "Allocatable MC object device unbound from fsl_mc_allocator driver");