mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 23:36:45 +07:00
staging: fsl-mc: refactored error exit in allocator probe/remove
Replaced error gotos with direct returns in fsl_mc_allocator_probe() and fsl_mc_allocator_remove(), since the only error handling done in those functions is to exit. Signed-off-by: J. German Rivera <German.Rivera@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6958cd4483
commit
09a38ab0b1
@ -474,30 +474,27 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
|
|||||||
enum fsl_mc_pool_type pool_type;
|
enum fsl_mc_pool_type pool_type;
|
||||||
struct fsl_mc_device *mc_bus_dev;
|
struct fsl_mc_device *mc_bus_dev;
|
||||||
struct fsl_mc_bus *mc_bus;
|
struct fsl_mc_bus *mc_bus;
|
||||||
int error = -EINVAL;
|
int error;
|
||||||
|
|
||||||
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 error;
|
return -EINVAL;
|
||||||
|
|
||||||
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
|
mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent);
|
||||||
if (WARN_ON(mc_bus_dev->dev.bus != &fsl_mc_bus_type))
|
if (WARN_ON(mc_bus_dev->dev.bus != &fsl_mc_bus_type))
|
||||||
goto error;
|
return -EINVAL;
|
||||||
|
|
||||||
mc_bus = to_fsl_mc_bus(mc_bus_dev);
|
mc_bus = to_fsl_mc_bus(mc_bus_dev);
|
||||||
error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type);
|
error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
return error;
|
||||||
|
|
||||||
error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev);
|
error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error;
|
return error;
|
||||||
|
|
||||||
dev_dbg(&mc_dev->dev,
|
dev_dbg(&mc_dev->dev,
|
||||||
"Allocatable MC object device bound to fsl_mc_allocator driver");
|
"Allocatable MC object device bound to fsl_mc_allocator driver");
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -506,22 +503,20 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev)
|
|||||||
*/
|
*/
|
||||||
static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
|
static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev)
|
||||||
{
|
{
|
||||||
int error = -EINVAL;
|
int error;
|
||||||
|
|
||||||
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;
|
return -EINVAL;
|
||||||
|
|
||||||
if (mc_dev->resource) {
|
if (mc_dev->resource) {
|
||||||
error = fsl_mc_resource_pool_remove_device(mc_dev);
|
error = fsl_mc_resource_pool_remove_device(mc_dev);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto out;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
||||||
error = 0;
|
return 0;
|
||||||
out:
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct fsl_mc_device_match_id match_id_table[] = {
|
static const struct fsl_mc_device_match_id match_id_table[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user