staging: fsl-mc: remove some superfluous WARN_ONs

These WARN_ONs shouldn't trigger unless something went very wrong.
Since the driver is in a stable state let's remove these debug
WARN_ONs.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Laurentiu Tudor 2017-11-17 15:38:31 +02:00 committed by Greg Kroah-Hartman
parent 53639c64c6
commit d8e026a449
6 changed files with 0 additions and 53 deletions

View File

@ -39,8 +39,6 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data)
struct fsl_mc_child_objs *objs; struct fsl_mc_child_objs *objs;
struct fsl_mc_device *mc_dev; struct fsl_mc_device *mc_dev;
WARN_ON(!dev);
WARN_ON(!data);
mc_dev = to_fsl_mc_device(dev); mc_dev = to_fsl_mc_device(dev);
objs = data; objs = data;
@ -60,8 +58,6 @@ static int __fsl_mc_device_remove_if_not_in_mc(struct device *dev, void *data)
static int __fsl_mc_device_remove(struct device *dev, void *data) static int __fsl_mc_device_remove(struct device *dev, void *data)
{ {
WARN_ON(!dev);
WARN_ON(data);
fsl_mc_device_remove(to_fsl_mc_device(dev)); fsl_mc_device_remove(to_fsl_mc_device(dev));
return 0; return 0;
} }
@ -453,8 +449,6 @@ static int disable_dprc_irq(struct fsl_mc_device *mc_dev)
int error; int error;
struct fsl_mc_io *mc_io = mc_dev->mc_io; struct fsl_mc_io *mc_io = mc_dev->mc_io;
WARN_ON(mc_dev->obj_desc.irq_count != 1);
/* /*
* Disable generation of interrupt, while we configure it: * Disable generation of interrupt, while we configure it:
*/ */
@ -496,8 +490,6 @@ static int register_dprc_irq_handler(struct fsl_mc_device *mc_dev)
int error; int error;
struct fsl_mc_device_irq *irq = mc_dev->irqs[0]; struct fsl_mc_device_irq *irq = mc_dev->irqs[0];
WARN_ON(mc_dev->obj_desc.irq_count != 1);
/* /*
* NOTE: devm_request_threaded_irq() invokes the device-specific * NOTE: devm_request_threaded_irq() invokes the device-specific
* function that programs the MSI physically in the device * function that programs the MSI physically in the device

View File

@ -199,7 +199,6 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
struct fsl_mc_resource, node); struct fsl_mc_resource, node);
if (!resource) { if (!resource) {
WARN_ON(res_pool->free_count != 0);
error = -ENXIO; error = -ENXIO;
dev_err(&mc_bus_dev->dev, dev_err(&mc_bus_dev->dev,
"No more resources of type %s left\n", "No more resources of type %s left\n",
@ -474,7 +473,6 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev)
irqs[i] = to_fsl_mc_irq(resource); irqs[i] = to_fsl_mc_irq(resource);
res_allocated_count++; res_allocated_count++;
WARN_ON(irqs[i]->mc_dev);
irqs[i]->mc_dev = mc_dev; irqs[i]->mc_dev = mc_dev;
irqs[i]->dev_irq_index = i; irqs[i]->dev_irq_index = i;
} }
@ -516,7 +514,6 @@ void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev)
return; return;
for (i = 0; i < irq_count; i++) { for (i = 0; i < irq_count; i++) {
WARN_ON(!irqs[i]->mc_dev);
irqs[i]->mc_dev = NULL; irqs[i]->mc_dev = NULL;
fsl_mc_resource_free(&irqs[i]->resource); fsl_mc_resource_free(&irqs[i]->resource);
} }
@ -553,17 +550,10 @@ static void fsl_mc_cleanup_resource_pool(struct fsl_mc_device *mc_bus_dev,
&mc_bus->resource_pools[pool_type]; &mc_bus->resource_pools[pool_type];
int free_count = 0; int free_count = 0;
WARN_ON(res_pool->type != pool_type);
WARN_ON(res_pool->free_count != res_pool->max_count);
list_for_each_entry_safe(resource, next, &res_pool->free_list, node) { list_for_each_entry_safe(resource, next, &res_pool->free_list, node) {
free_count++; free_count++;
WARN_ON(resource->type != res_pool->type);
WARN_ON(resource->parent_pool != res_pool);
devm_kfree(&mc_bus_dev->dev, resource); devm_kfree(&mc_bus_dev->dev, resource);
} }
WARN_ON(free_count != res_pool->free_count);
} }
void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev) void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev)

View File

@ -162,12 +162,7 @@ static int fsl_mc_driver_probe(struct device *dev)
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
int error; int error;
if (WARN_ON(!dev->driver))
return -EINVAL;
mc_drv = to_fsl_mc_driver(dev->driver); mc_drv = to_fsl_mc_driver(dev->driver);
if (WARN_ON(!mc_drv->probe))
return -EINVAL;
error = mc_drv->probe(mc_dev); error = mc_drv->probe(mc_dev);
if (error < 0) { if (error < 0) {
@ -184,9 +179,6 @@ static int fsl_mc_driver_remove(struct device *dev)
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
int error; int error;
if (WARN_ON(!dev->driver))
return -EINVAL;
error = mc_drv->remove(mc_dev); error = mc_drv->remove(mc_dev);
if (error < 0) { if (error < 0) {
dev_err(dev, "%s failed: %d\n", __func__, error); dev_err(dev, "%s failed: %d\n", __func__, error);
@ -352,8 +344,6 @@ static int translate_mc_addr(struct fsl_mc_device *mc_dev,
struct fsl_mc *mc; struct fsl_mc *mc;
fsl_mc_get_root_dprc(&mc_dev->dev, &root_dprc_dev); fsl_mc_get_root_dprc(&mc_dev->dev, &root_dprc_dev);
if (WARN_ON(!root_dprc_dev))
return -EINVAL;
mc = dev_get_drvdata(root_dprc_dev->parent); mc = dev_get_drvdata(root_dprc_dev->parent);
if (mc->num_translation_ranges == 0) { if (mc->num_translation_ranges == 0) {
@ -401,7 +391,6 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev,
* type, as this object type is not supposed to have MMIO * type, as this object type is not supposed to have MMIO
* regions * regions
*/ */
WARN_ON(true);
return -EINVAL; return -EINVAL;
} }
@ -424,7 +413,6 @@ static int fsl_mc_device_get_mmio_regions(struct fsl_mc_device *mc_dev,
goto error_cleanup_regions; goto error_cleanup_regions;
} }
WARN_ON(region_desc.size == 0);
error = translate_mc_addr(mc_dev, mc_region_type, error = translate_mc_addr(mc_dev, mc_region_type,
region_desc.base_offset, region_desc.base_offset,
&regions[i].start); &regions[i].start);

View File

@ -124,7 +124,6 @@ static void fsl_mc_msi_write_msg(struct irq_data *irq_data,
struct fsl_mc_device_irq *mc_dev_irq = struct fsl_mc_device_irq *mc_dev_irq =
&mc_bus->irq_resources[msi_desc->fsl_mc.msi_index]; &mc_bus->irq_resources[msi_desc->fsl_mc.msi_index];
WARN_ON(mc_dev_irq->msi_desc != msi_desc);
msi_desc->msg = *msg; msi_desc->msg = *msg;
/* /*

View File

@ -93,9 +93,6 @@ int __init its_fsl_mc_msi_init(void)
continue; continue;
} }
WARN_ON(mc_msi_domain->host_data !=
&its_fsl_mc_msi_domain_info);
pr_info("fsl-mc MSI: %pOF domain created\n", np); pr_info("fsl-mc MSI: %pOF domain created\n", np);
} }

View File

@ -68,12 +68,6 @@ static void fsl_mc_io_unset_dpmcp(struct fsl_mc_io *mc_io)
int error; int error;
struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev; struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev;
if (WARN_ON(!dpmcp_dev))
return;
if (WARN_ON(dpmcp_dev->mc_io != mc_io))
return;
error = dpmcp_close(mc_io, error = dpmcp_close(mc_io,
0, 0,
dpmcp_dev->mc_handle); dpmcp_dev->mc_handle);
@ -224,8 +218,6 @@ int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
error = -EINVAL; error = -EINVAL;
dpmcp_dev = resource->data; dpmcp_dev = resource->data;
if (WARN_ON(!dpmcp_dev))
goto error_cleanup_resource;
if (dpmcp_dev->obj_desc.ver_major < DPMCP_MIN_VER_MAJOR || if (dpmcp_dev->obj_desc.ver_major < DPMCP_MIN_VER_MAJOR ||
(dpmcp_dev->obj_desc.ver_major == DPMCP_MIN_VER_MAJOR && (dpmcp_dev->obj_desc.ver_major == DPMCP_MIN_VER_MAJOR &&
@ -238,15 +230,9 @@ int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
goto error_cleanup_resource; goto error_cleanup_resource;
} }
if (WARN_ON(dpmcp_dev->obj_desc.region_count == 0))
goto error_cleanup_resource;
mc_portal_phys_addr = dpmcp_dev->regions[0].start; mc_portal_phys_addr = dpmcp_dev->regions[0].start;
mc_portal_size = resource_size(dpmcp_dev->regions); mc_portal_size = resource_size(dpmcp_dev->regions);
if (WARN_ON(mc_portal_size != mc_bus_dev->mc_io->portal_size))
goto error_cleanup_resource;
error = fsl_create_mc_io(&mc_bus_dev->dev, error = fsl_create_mc_io(&mc_bus_dev->dev,
mc_portal_phys_addr, mc_portal_phys_addr,
mc_portal_size, dpmcp_dev, mc_portal_size, dpmcp_dev,
@ -279,8 +265,6 @@ void fsl_mc_portal_free(struct fsl_mc_io *mc_io)
* to have a DPMCP object associated with. * to have a DPMCP object associated with.
*/ */
dpmcp_dev = mc_io->dpmcp_dev; dpmcp_dev = mc_io->dpmcp_dev;
if (WARN_ON(!dpmcp_dev))
return;
resource = dpmcp_dev->resource; resource = dpmcp_dev->resource;
if (WARN_ON(!resource || resource->type != FSL_MC_POOL_DPMCP)) if (WARN_ON(!resource || resource->type != FSL_MC_POOL_DPMCP))
@ -304,9 +288,6 @@ int fsl_mc_portal_reset(struct fsl_mc_io *mc_io)
int error; int error;
struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev; struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev;
if (WARN_ON(!dpmcp_dev))
return -EINVAL;
error = dpmcp_reset(mc_io, 0, dpmcp_dev->mc_handle); error = dpmcp_reset(mc_io, 0, dpmcp_dev->mc_handle);
if (error < 0) { if (error < 0) {
dev_err(&dpmcp_dev->dev, "dpmcp_reset() failed: %d\n", error); dev_err(&dpmcp_dev->dev, "dpmcp_reset() failed: %d\n", error);