return -ENOMEM;
drvdata->cpu = coresight_get_cpu(dev);
+ if (drvdata->cpu < 0)
+ return drvdata->cpu;
+
if (per_cpu(debug_drvdata, drvdata->cpu)) {
dev_err(dev, "CPU%d drvdata has already been initialized\n",
drvdata->cpu);
spin_lock_init(&drvdata->spinlock);
drvdata->cpu = coresight_get_cpu(dev);
+ if (drvdata->cpu < 0)
+ return drvdata->cpu;
+
desc.name = devm_kasprintf(dev, GFP_KERNEL, "etm%d", drvdata->cpu);
if (!desc.name)
return -ENOMEM;
struct device_node *dn;
if (!dev->of_node)
- return 0;
+ return -ENODEV;
+
dn = of_parse_phandle(dev->of_node, "cpu", 0);
- /* Affinity defaults to CPU0 */
if (!dn)
- return 0;
+ return -ENODEV;
+
cpu = of_cpu_node_to_id(dn);
of_node_put(dn);
- /* Affinity to CPU0 if no cpu nodes are found */
- return (cpu < 0) ? 0 : cpu;
+ return cpu;
}
/*
static inline int of_coresight_get_cpu(struct device *dev)
{
- return 0;
+ return -ENODEV;
}
#endif
struct acpi_device *adev = ACPI_COMPANION(dev);
if (!adev)
- return 0;
+ return -ENODEV;
status = acpi_get_parent(adev->handle, &cpu_handle);
if (ACPI_FAILURE(status))
- return 0;
+ return -ENODEV;
cpu = acpi_handle_to_logical_cpuid(cpu_handle);
if (cpu >= nr_cpu_ids)
- return 0;
+ return -ENODEV;
return cpu;
}
static inline int acpi_coresight_get_cpu(struct device *dev)
{
- return 0;
+ return -ENODEV;
}
#endif